Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

VCConfiguration AddPropertySheet

16 views
Skip to first unread message

bmelt

unread,
Apr 11, 2010, 5:01:01 PM4/11/10
to
In my program that automates various versions of Visual Studio, I can use
following code on VS 2010:
for each(Project^ projo in dte->Solution->Projects)
{
VCProject^ proj = (VCProject^)projo->Object;
IVCCollection^ cfgs = (IVCCollection^)proj->Configurations;
for each (VCConfiguration^ c in cfgs)
{
String^ prop = PropertiesPath;
c->AddPropertySheet(prop);
}
dte->Solution->Close(true);

Now I need to compile on .NET 2.0 and use the same functionality automating
VS 2010.
When I replace c->AddPropertySheet(prop) with
c->GetType()->InvokeMember("AddPropertySheet", BindingFlags::InvokeMethod,
nullptr, c, gcnew cli::array<Object^> { prop });
I receive TargetInvocationException thrown by the target of invocation.
How can I use AddPropertySheet from a program that is built on 2.0 but is
used for automation of VS 2010?

0 new messages