Selecting which project under a solution to debug or run in Visual Studio 2010

37,382

Solution 1

You can right click on the project and choose to set as startup project

Solution 2

You can right-click a project and set it as the Startup Project. It then is debugged when you press F5, or run when you press Ctrl-F5.

You can right-click a project and select Debug / Start new instance to debug a project that is not the startup project.

On a side note, you can run / debug the unit tests without setting the unit test project as the startup one. There are icons (and keyboard shortcuts) in the toolbar to run or debug unit tests at various scopes (if not visible right-click your toolbar and select Test Tools).

Solution 3

1) In the Solution-Explorer, right-click on the project that is the project for the executable assembly, and select "Set as Startup Project". This will make the project show in bold, and will be run automatically when you press F5.

2) Alternatively, in the Solution-Explorer, right-click on the project that is the project for the executable assembly, and select "Debug -> Start New Instance". This will start the debug session immediately.

Solution 4

This was my quickly Startup Project change way for me:

  1. Tools > Customize > Commands Tab.
  2. Choose Toolbar selection
  3. Select Standard toolbar. Customize Window
  4. Choose a place by mouse for new icon on menu preview and click Add Command... button
  5. Go to Project item on Categories list on opened Add Command window.
  6. Select Set as Startup Project item on Commands list enter image description here
  7. Now, you can Set current project as Startup Project just one click enter image description here

But today I want more quickly way, then I finally found a way to set a shortcut for Set as Startup Project menu.

Just set a shortcut for "ClassViewContextMenus.ClassViewProject.Debug.Startnewinstance" item at Tools > Options > Enviroment > Keyboard

I set Ctrl + Alt + Shift + F5

Share:
37,382

Related videos on Youtube

Parris
Author by

Parris

Fullstack engineer gone frontend. Currently Director of Web at Brigade. Formerly PM and Lead Frontend Engineer at Eventbrite. Focused on JS, React, GraphQL, Postgres and Build Systems. Also, familiar with WebGL, Python, (unfortunately) PHP, Go, Rust, Java and of course CSS/HTML. Current side projects: - https://github.com/fervorous/fervor - https://npmjs.org/package/iz Older projects - https://github.com/eventbrite/cartogram - https://github.com/parris/a_star.js - https://github.com/eventbrite/dorsal - https://www.npmjs.com/package/mixablejs

Updated on July 09, 2022

Comments

  • Parris
    Parris almost 2 years

    This one should be easy. I just can't figure out what to search for...

    For this one solution I created a unit test project, and I've been adding unit tests frantically. When I went back to try to run the original project after making all the unit tests pass I realized that I couldn't figure out how to debug the original project.

    In other words, every time I try to "debug" (e.g., by pressing F5), Visual Studio will run the unit tests. So the question is how do I run various projects in a single solution? How do I select which one will run when I want it to?

  • StuartLC
    StuartLC about 12 years
    There's a 3rd way too - right clicking on the solution and you can choose multiple startup projects.
  • Robaticus
    Robaticus about 12 years
    I believe F5 starts the startup project. You can also right click on the solution and set it to start multiple projects on F5.
  • Eric J.
    Eric J. about 12 years
    F5 will start debugging the current Startup Project, not the one corresponding to the current source code file.
  • Parris
    Parris about 12 years
    Yea, if you want to go back to using f5 you need to select "Setup as startup project"; otherwise, you need to "Debug"->Start new Instance as someone said below. I don't know how I didn't see that one before. Thanks :)!