Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you store start action / startup projects in project/sln files?

When I change a web application project's Start Action (such as Current Page, Specific Page, Don't open a page, etc.) and save, Visual Studio doesn't store this selection in a file that is likely to get checked in to source control such as csproj or sln. Likewise, if I go to solution properties and select several multiple startup projects and save, this selection is not stored in such a file either. Is there a way I can store this info in files that will get checked in to source control rather than user settings files?

like image 254
Jez Avatar asked Jun 01 '18 13:06

Jez


People also ask

What .sln file contains?

sln file. The . sln file contains text-based information the environment uses to find and load the name-value parameters for the persisted data and the project VSPackages it references. When a user opens a solution, the environment cycles through the preSolution , Project , and postSolution information in the .

How do I save multiple startup projects in Visual Studio?

You can select multiple startup projects in the solution properties. Go to the Solution Explorer, right-click on the name of your solution and select the option “Set StartUp Projects…“: The settings dialog offers you all the possible combinations to start projects in your solution.

How do I create an .sln file from an existing project?

Solution 1 From the Visual Studio menu choose "File | New | Project..." Solutions" and create a blank solution. point it to your web site to add it to your new solution.

How can I run a project without sln?

sln), you must do: Menu File → Open → Web Site... And choose the folder where the project is. Save this answer.


1 Answers

These configurations are stored in the Solution User Options (.suo) file and they are not meant to be stored in source control, Microsoft Documentations:

The solution user options (.suo) file contains per-user solution options. This file should not be checked in to source code control.

Startup Project, is a per user settings... a tester may want to set the test project for his startup while the developer wants the web project. The developer does not want his personal settings overwritten, every time he gets the latest version.

But, you can choose a default Startup Project, which would be used when there is no .suo file... to do this:

Open your solution file (.sln) in a text editor, you would see a list of your projects on top of this file, between Project & EndProject tags.

The first project in this list would become your default startup project, so you can reorder the project list and save your .sln file in source control.

enter image description here

Now if you delete your .suo file and reopen your solution in Visual Studio, the first project from the list becomes your startup project... and Visual Studio would create a new .suo file for you. I found this information on this stackoverflow post.

like image 182
Hooman Bahreini Avatar answered Sep 28 '22 11:09

Hooman Bahreini