Set as Startup Project in Visual Studio
I was struggling with trying to figure out why a certain solution of mine wasn't starting right. It was in VB with four projects. Upon initial open it would set a certain project with a DLL output as startup. If I set the EXE as startup project, it was fine, but when I distribute code I always clean it by removing *.suo and *.user files, and bin/obj folders. Upon opening the €œcleaned € version, it would always revert to the DLL project and fail to F5 nicely. The fix turned out to be simple, though I'm curious as to why I needed to do this at all.
In the solution file, there are a list of pseudo-XML €œProject € entries. It turns out that whatever is the first one ends up as the Startup Project, unless it's overridden in the suo file. Argh. I just rearranged the order in the file and it's good.
I'm guessing that C# is the same way but I didn't test it. I hope that this helps someone!
4 Comments
Ben Dalby said
I've just tried it with C# solutions in VS 2005 and it works in the same way. It became a problem for me when I started messing around with solution folders,<br /><br />Thanks!<br /><br />Ben
identity protection said
That's definitely a great tip Kendrick. Rearranging the order of the projects in sin did the job.
Kendrick said
Great post/tip! I ran into the same issue in Visual Studio 2008. When I deleted the .suo file, the solution defaulted to a helper project instead of the main project as the one for startup. Rearranging the order of the projects in the .sln file worked like a charm.
Ulf said
Or you could select the solution in the Solution Explorer and then click Project>Set StartUp Projects... and set it from there. :-)