Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is "Set as Startup" option stored in the suo file and not the sln file?

People also ask

What is the purpose of the * .sln file in Visual Studio projects?

What is SLN file? A file with . SLN extension represents a Visual Studio solution file that keeps information about the organization of projects in a solution file. The contents of such a solution file are written in plain text inside the file and can be observed/edited by opening the file in any text editor.

Is SLN file necessary?

As far as I'm aware, the SLN is a 100% Visual Studio Tooling concept. You can still create applications, run/compile/publish them without this file. That's how Visual Studio Code does it and that's how you would do it in Sublime/Atom or any other editors.

How do I create a .SLN file?

Using Visual Studio 2015 Go to New -> Website -> Select the root directory of the website in need of a new . sln file -> Next -> It will ask to create new site in directory or open the website in directory, obviously select the latter.


It is absolutely necessary that everyone can define their StartUp Project themselves, as Jon has already said. But to have a dedicated default one would be great, and as I can tell, it is possible!

If you don’t have a .suo file in your solution directory, Visual Studio picks the first project in your .sln file as the default startup project.

  1. Close your Visual Studio and open the .sln file in your favorite text editor. Starting in line 4, you see all your projects encapsulated in ProjectEndProject lines.

  2. Cut and paste the desired default startup project to the top position.

  3. Delete your .suo file.

  4. Open your solution in Visual Studio. Ta daa!


In most cases, it does make sense to have a default on this.

It would be much better to accommodate a default startup project and store this in the .sln file, but which can be overridden by a developer in their .suo file. If the startup setting isn’t found in the .suo file, the default startup project in the .sln would be used.

Actually, this has been suggested on Visual Studio’s UserVoice.


Why should it be a non-user-specific preference?

If I've got a solution with 10 files in, and one developer is primarily testing/using one of those tools, why should that affect what I start up?

I think MS made the right choice on this one. The project I want to start is far from necessarily the project that other developers want to start.


I wrote a little command line utility for Windows called slnStartupProject to set the Startup Project automatically:

slnStartupProject slnFilename projectName

I personally use it to set the startup project after generating the solution with cmake that always sets a dummy ALL_BUILD project as the first project in the solution.

The source is on GitHub. Forks and feedback are welcome.