Run multiple instances with one click in Visual Studio

Visual StudioVisual Studio-2010Debugging

Visual Studio Problem Overview


I wonder if I can run multiple instances (right now two instances) of my application in debug mode by doing a simple click or set a key for that...

Visual Studio Solutions


Solution 1 - Visual Studio

Not many people seem to know this, but this is perfectly possible, though I admit it's not very obvious. Here's what you do:

  • suppose your current project is A, and it's output is c:\bin\my.exe
  • add an empty project to the solution for A, call it 'Dummy'
  • under Dummy's Project Properties->Debugging set the Command to point c:\bin\my.exe
  • under Solution Properties->Configuration Manager, uncheck all builds of the Dummy project so VS won't try to build it (building an empty project fails)
  • under Solution Properties->Startup Project, select Multiple Startup Projects and set the Action for both A and Dummy to Start
  • now hit F5 and your exe will be launched twice, each under a seperate debugging instance. (as you will be able to see in the Debug->View->Processes window)

Solution 2 - Visual Studio

You can use "Multiple Startup Projects" feature, but avoid creating dummy projects by hand: just add your debuggee executable into the solution directly:

  • Solution > Add existing project > Path to .exe

If you neeed several instances, Visual Studio won't allow you to add the same executable twice, but adding a symlink to it with another name works as expected.

MSDN: How to: Debug an Executable Not Part of a Visual Studio Solution

Solution 3 - Visual Studio

Is Visual Studio 2013 this is even easier!

Project-> Properties -> Debug -> check "Start external program" and click the ... button, navigate to your .exe of the other program.

Then Make sure in your Solution -> Properties -> MultipleStartup Projects that it's checked.

Solution 4 - Visual Studio

You can run two instances of your application from where it is built; example: d:\test\bin\debug\app.exe and attach both instances to the Visual Studio 2010 debugger.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMCAView Question on Stackoverflow
Solution 1 - Visual StudiostijnView Answer on Stackoverflow
Solution 2 - Visual StudioVladimir SinenkoView Answer on Stackoverflow
Solution 3 - Visual StudioFred JohnsonView Answer on Stackoverflow
Solution 4 - Visual StudioViVView Answer on Stackoverflow