Coder Perfect

Why is the option “Set as Startup” stored in the suo file rather than the sln file?

Problem

This setting appears to be one that should be saved in the solution file and made available to all users as part of source code control. Because we don’t check in the suo file, each user must set this on their own, which seems odd.

Asked by leora

Solution #1

As Jon has already stated, it is critical that everyone be able to define their own StartUp Project. However, having a dedicated default one would be fantastic, and as far as I can see, this is feasible!

If your solution directory lacks a.suo file, Visual Studio uses the first project in your.sln file as the default startup project.

Answered by Oliver

Solution #2

In most circumstances, having a default on this is a good idea.

It would be far preferable to have a default startup project in the.sln file, which can be altered by a developer in their.suo file. If the startup setting isn’t found in the.suo file, the default startup project from the.sln is used instead.

This was really suggested on the UserVoice forum for Visual Studio.

Answered by Wim

Solution #3

Why should it be a preference that isn’t particular to the user?

Why should it matter if I have a solution with ten files in it and one developer is mostly testing/using one of those tools?

On this one, I believe MS made the proper decision. The project I’d like to start isn’t necessarily the same as what other developers would like to start.

Answered by Jon Skeet

Solution #4

To set the Startup Project automatically, I built a little command line application for Windows named slnStartupProject:

slnStartupProject slnFilename projectName

After generating the solution with cmake, which always sets a fake ALL BUILD project as the first project in the solution, I use it to set the starter project.

The source code is available on GitHub. We welcome suggestions and criticism.

Answered by michaK

Solution #5

If you’re using GIT, you can commit the default SUO file and then use the Indicate As Unmodified command to mark it as unchanged.

git update-index --assume-unchanged YourSolution.suo

It also works if you want multiple projects in your default start group. The only negative I’m aware of is that everyone who doesn’t wish to commit the SUO file must run this command.

Answered by sebetovsky

Post is based on https://stackoverflow.com/questions/694730/why-is-set-as-startup-option-stored-in-the-suo-file-and-not-the-sln-file