Why Is "Set as Startup" Option Stored in the Suo File and Not the Sln File

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

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.

What determines the default startup project?

  1. If there is a *.suo file, the Startup Project is saved there.
  2. Otherwise, the first project listed in the *.sln file will be the Startup.

(tested with VS 2013)

Visual Studio: Where does it store Set as startup project?

Yes, it is stored in the .suo file.

Here's a similar post explaining why.

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

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.

Sample Image

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.

Is it possible to set the Xamarin Studio StartupItem 'per user' and not in the sln file?

Just a note - Xamarin has fixed this in version 5.7:

http://developer.xamarin.com/releases/studio/xamarin.studio_5.7/xamarin.studio_5.7/

From the release notes: "The startup project name is now stored in the user solution settings file instead of the .sln file."

So >= v 5.7 no filters or anything special should be needed.

Where is Set as Startup defined and persisted in C# winforms solutions?

Which project is the "startup" project only has any relevance for debugging, which means it's user metadata from the point of the solution and the projects. Regardless of which project is the "startup" project, the compiled code is the same.

Because of this, the information is stored as a user setting in the Solution User Options file (solution.suo) which accompanies the Solution file (solution.sln). The .suo file "Records all of the options that you might associate with your solution so that each time you open it, it includes customizations that you have made" according to MSDN.

The .suo file is a binary file. If you want to read or change it programatically, you have to use IVsPersistSolutionOpts.LoadUserOptions from the Microsoft.VisualStudio.Shell.Interop namespace.

Where is the Startup Project setting stored for a solution?

Reference 1

Arian Kulp says:

I was struggling with trying to figure
out why a certain solution of mine
wasn’t starting right. It was in VB
with four projects. Upon initial open
it would set a certain project with a
DLL output as startup. If I set the
EXE as startup project, it was fine,
but when I distribute code I always
clean it by removing *.suo and *.user
files, and bin/obj folders. Upon
opening the “cleaned” version, it
would always revert to the DLL project
and fail to F5 nicely. The fix turned
out to be simple, though I’m curious
as to why I needed to do this at all.

In the solution file, there are a list
of pseudo-XML “Project” entries. It
turns out that whatever is the first
one ends up as the Startup Project,
unless it’s overridden in the suo
file. Argh. I just rearranged the
order in the file and it’s good.

I’m guessing that C# is the same way
but I didn’t test it. I hope that
this helps someone!

Reference 2

Setting the StartUp Project

Which project is the "startup" project only has any relevance for debugging, which means it's user metadata from the point of the solution and the projects. Regardless of which project is the "startup" project, the compiled code is the same.

Because of this, the information is stored as a user setting in the Solution User Options file (solution.suo) which accompanies the Solution file (solution.sln). The .suo file "Records all of the options that you might associate with your solution so that each time you open it, it includes customizations that you have made" according to MSDN.

The .suo file is a binary file. If you want to read or change it programatically, you have to use IVsPersistSolutionOpts.LoadUserOptions from the Microsoft.VisualStudio.Shell.Interop namespace.



Related Topics



Leave a reply



Submit