Saturday, 7 April 2007

Changing the default startup project preference

By default, visual studio sets the first project that you add to a solution as the startup project when you hit the Debug-->Start (F5) or Debug-->Start without debugging options (ctrl-F5). This can be particularly annoying, especially when developing client server applications. You may want to start the server first, then when it is listening, start the client. You may want to start multiple projects at the same time. Now these options are available by right clicking on the solution and selecting Properties, Common Properties-->Startup Project.

By default single startup project is selected and the project currently in the drop down is what visual studio will try and start. I have recently acquired a taste for current selection (when you have are writing unit tests it is particularly handy for quickly running the current test project).

You can change the default for this by navigating to tools-->options-->Environment-->Projects and Solutions-->Build and Run. And there tick the check box "For new solutions use the currently selected project as the start up project". If you have a large solution it may also be worth checking the "Only build startup projects and dependencies on run" in order to avoid building everything to run some low level test.

Incidently, changing the default startup options doesn't just effect new solutions as the name suggests, it will effect any solution that doesn't have an options file (solutionname.suo). This means that in a team environment, as long as everyone has their own solution option files, changing this option will not effect other users.

No comments: