29

I have a Visual Studio 2010 solution with several projects. One of the projects is set as the default project, but I want to change that by default.

I know that I can right click the project I want to be the startup project and select "Set as StartUp project", but this setting will be stored in the user's files (.slo and .user files).

As a company policy, we don't check these files in the source control system, therefore when another user opens the solution it will have a different project as the startup object.

Is there another way to set these values? Something like a setting on the .sln or .proj files?

Thanks

Melchia
  • 22,578
  • 22
  • 103
  • 117
willvv
  • 8,439
  • 16
  • 66
  • 101

2 Answers2

46

From Arian Kulp's site, the way to change the default startup project for a solution is to edit the .sln file. You'll see some Project and EndProject lines. The first Project listed will be the default startup project, so just move the one you want to the top.

mgttlinger
  • 1,435
  • 2
  • 21
  • 35
Tim S.
  • 55,448
  • 7
  • 96
  • 122
  • 2
    Link changed to archived version of the page. – mgttlinger Oct 17 '14 at 10:55
  • 1
    This worked for me but sometimes it wouldn't stick... I tried also moving the few lines at the bottom in the "GlobalSection(ProjectConfigurationPlatforms) = postSolution" section that related to the build configuration GUID of the project. The above solution worked for me once before but this time I had to move the other lines to get it to work properly. – Jaydel Gluckie Jul 09 '21 at 17:34
  • 1
    Move up the GUID folders, then the main GUID project – Andrei Krasutski Jan 24 '22 at 20:37
  • I had to delete the `.vs` directory after making the change to the `.sln` file but then it worked – Dan Jan 02 '23 at 15:03
-1

Follow these steps:

  1. Choose the name of the project which you want to set default startup project
  2. Click to the Project on toolbar and then click Set as startup project
thinh
  • 33
  • 1
  • 3
    Whilst this works for the local user (and works well), it doesn't address the original question. Which project is the default is stored in a local .suo file (under the .vs folder) and since this is typically excluded from source control it means that when another user opens the solution they end up with a different project as the startup project. Your answer doesn't help here. – Brian Cryer Sep 27 '22 at 08:21