Visual Studio Tips and tricks: Default startup project

 
 
  • Gérald Barré

When you first open a solution, you just want to press F5 to start debugging. If the solution contains multiple projects, you want the main project to be the startup project. You don't want the library project to be the startup project, but the web or desktop application. This provides a good development experience. Of course, you can change the startup project manually using the context menu or the project dropdown menu:

Visual Studio selects the first project of the solution as the startup project unless you change it manually. So, if you want your solution to be well configured for the first use, you may need to change the project order in the sln file. Simply move the project above all other projects:

If you open Visual Studio, the startup project should be the application:

It's a little change, but it's so convenient when you clone a repository and open the solution in Visual Studio for the first time.

#Slnx format

If you're using the newer .slnx format (default in Visual Studio 2026), you can explicitly set the startup project using the DefaultStartup attribute:

XML
<Solution>
    <Project DefaultStartup="true" Path="MainProject.csproj" />
    <Project Path="AnotherProject.csproj" />
</Solution>

This approach is more explicit and reliable than reordering projects in the traditional .sln format. Note that this attribute only defines the default startup project when the solution is first opened; users can still change the startup project manually afterward and the data is persisted in the .suo file.

Learn more about defining the default startup project in slnx

This post is part of the series 'Visual Studio Tips and Tricks'. Be sure to check out the rest of the blog posts of the series!

Do you have a question or a suggestion about this post? Contact me!

Follow me:
Enjoy this blog?Buy Me A Coffee💖 Sponsor on GitHub