How to choose which project is built on F5 in Visual Studio?

6,965

Solution 1

The generic way to do this is to set the project that you want to run as the startup project. Then, that project will run on debug, build, or whatever you are running.

Note: This is not a temporary thing (i.e. it will not revert itself) but you can set the other project to be the startup project whenever you want.

Solution 2

Not exactly what you want, but this may suffice as an alternative (since I don't believe a shortcut like you want exists inherently):

  • In the Solution Explorer right-click the Solution and pick Properties.
  • Select "Startup Project".
  • Select "Current Selection".

That way it will run/debug the currently selected project in the solution when you hit the shortcut keys.

Note: Same question found on StackOverflow: Run active project in Visual Studio 2010

Solution 3

Try the SwitchStartupProject extension, as suggested in this question. It adds a drop-down list to your toolbar that lets you switch startup project quicker than using the Solution Explorer.

Share:
6,965

Related videos on Youtube

jeff
Author by

jeff

Updated on September 18, 2022

Comments

  • jeff
    jeff over 1 year

    I have a solution file for IntraFace, which contains two projects, namely IntraFaceTracker and IntraFaceDetector (see the image). By default, IntraFaceTracker is selected, you can see its name is bold.

    So when I press F5, Tracker project starts running. To run Detector project instead, I have to do it manually with the mouse cursor as in the picture.

    So how can I change -temporarily- to run the Detector project on F5 ?

    Thanks for any help in advance.

    enter image description here

  • jeff
    jeff about 10 years
    Ok, that's temporary enough for me :) Thanks !
  • Ramhound
    Ramhound about 10 years
    Actually this is the only way I know. Been using VS.net since before the first version in 2000
  • soandos
    soandos about 10 years
    @CengizFrostclaw, if it answers the question, can you please mark it as the answer
  • DavidPostill
    DavidPostill about 9 years
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.
  • Ashley
    Ashley about 9 years
    Actually, I think this post contains all the necessary information, and there is nothing to be gained by copying or summarising any of the linked pages. The important point is that there is an extension called 'SwitchStartupProject'. Even if the Visual Studio gallery goes down one day, that will still be the name of the extension, and the reader will have to find it from another source. Further, the linked answer is almost exactly the same as mine; I only linked to it to credit the author of the extension.