Hello all,
I am trying to edit the SolutionBuild2.StartupProjects property, which is
[get, set], and is defined to be Object [] (even though, according to the
doc and my findings, is actually an array of strings). I can see the current
values, but I have not been able to modify it.
So far I have tried two approaches and neither seem to work:
1.- Modify the existing value of the property (editing the array)
2.- Creating a new array and assigning it to the property.
Neither approach seems to work. Even more frustrating is the fact that the
intructions below run without complaints but do not modify the property.
Clearly I must modifying something, somewhere (*gasp*), but not what I want.
Here is a simplified version of the code:
-------------
// _applicationObject is a DTE2 interface to the app object
SolutionBuild2 sb =
(SolutionBuild2)_applicationObject.Solution.SolutionBuild;
// This doesn't work
((Object[])sb.StartupProjects)[0] = "MyNewStartupProject";
// Neither does this
string[] saMystringArray = { "MyNewStartupProject" };
sb.StartupProjects = saMystringArray;
--------------
Has anyone here been able to modify this property successfully? Any ideas of
what I could be doing wrong?
Thanks, and best regards!
-Luis Bascones
Luis Bascones - 23 Jan 2007 21:35 GMT
Never mind - I figured it out.
Thanks much,
-Luis Bascones
> Hello all,
>
[quoted text clipped - 35 lines]
>
> -Luis Bascones
ocanada - 02 Dec 2007 22:10 GMT
Hi Luis,
I would have been interested in the way you succeeded in defining multi
startup projects to a solution.
I've tried like you without success:
string[] startupProjects = {startupProject.UniqueName, startupProject2.
UniqueName};
vs.Solution.SolutionBuild.StartupProjects = startupProjects;
Regards,
Olivier
>Never mind - I figured it out.
>
[quoted text clipped - 7 lines]
>>
>> -Luis Bascones
ocanada - 04 Dec 2007 08:45 GMT
Hi,
As I got the solution, I've decided to post it here for others:
Actually you have to declare a object array instead of a string array. So the
code below will work:
object[] startupProjects = {startupProject.UniqueName, startupProject2.
UniqueName};
vs.Solution.SolutionBuild.StartupProjects = startupProjects;
Regards,
Olivier
>Hi Luis,
>
[quoted text clipped - 14 lines]
>>>
>>> -Luis Bascones