简体   繁体   中英

Visual Studio 2017 Debug Multiple Instances of the Same Project

I have created a single command line application that handles different jobs per a command line argument. For instance, the "-w" starts a web project and "-c" runs a simple command line process.

Sometimes these two projects have to speak with each other. For instance, I start one instance with "-w" and an API web application launches. I start a second instance with "-c" and a command line application connects via API and processes some returned data.

I understand that I can debug multiple different projects at the same time, but is there a way to debug multiple instances of the SAME project in Visual Studio?

Yes:

  1. Debug your program normally to get the first instance
  2. Right click on your project in Solution Explorer and select Debug -> Start New Instance

You can also launch other programs in your solution as well.

If you want to pass different startup arguments to each instance, than you can do following:

For each instance you want to run:

  1. Add New Empty Project to the same Solution

  2. Under Project Properties -> Debugging specify

    • Command -> for example absolute path to the project .exe
    • Command Arguments
    • eventually other options like working dir , etc.
  3. Under Solution Properties choose Multiple startup projects and select projects you want to Debug at the same time

Now if you hit F5 you can debug all projects you want eventually some multiple instances with specific command line arguments for each one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM