A command line utility to set the default StartUp Project of a Visual Studio solution file
slnStartupProject slnFilename projectName
slnFilename: path to the Visual Studio solution file to modify
projectName: Name of the project to set as the default StartUp project
slnStartupProject searches slnFilename for a project called projectName and moves its definition at the top of the file.
When Visual Studio opens a sln file for the first time, it sets the very first project as the startup project and then stores it in the associated .suo file. This often make the first build fail and forces the developer to locate the project, right-click on it and select "Set as StartUp Project" for the build to succeed and launch. It is pretty annoying for maniacs like me. This becomes extremely relevant when you generate your solution using cmake as cmake 3.5 and older always sets the dummy project ALL_BUILD as the first project. In CMake 3.6 and newer, there is now a VS_STARTUP_PROJECT property that allows the CMake author to specify the default startup project.
You can now integrate slnStartupProject in your build script and make sure the projects you generate will build and launch everytime a developer hits F5
Hope this helps you.
slnStartupProject can also be used as a referenced library in your project to manipulate the startup project of a .sln file directly from a .NET program.
slnStartupProject.Parser.SetStartupProject(string slnFilename, string projectName);
I recommend installing the library through the Visual Studio package manager or the nuget command line utility.
The source is in the src directory and you will find a Visual Studio 2013 sln / csproj in the projects directory
I also provided an additional sln for Visual Studio 2008 ready to be upgraded to your needs
The binary and library distribution can be found on nuget.org:
https://www.nuget.org/packages/slnStartupProject/
PM> Install-Package slnStartupProject
https://www.nuget.org/packages/slnStartupProjectLibrary/
PM> Install-Package slnStartupProjectLibrary
slnStartupProject is licensed under the MIT License, see LICENSE for more information.