Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / December 2007

Tip: Looking for answers? Try searching our database.

Editing DTE2.Solution.SolutionBuild.StartupProjects

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Luis Bascones - 23 Jan 2007 17:47 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.