79229035

Date: 2024-11-27 05:41:15
Score: 0.5
Natty:
Report link

I figured out it is actually possible. It is a workaround, though, and it requires manual editing of the solution file. Here are the steps

  1. Start debugging your executable from a command line like this

DevEnv /DebugExe YourApp.exe Arg1 Arg2 ArgN

It will start Visual Studio, create a solution, create a type of a project that I don't know how to create another way and starts debugging. If somebody knows how to create this type of project from Visual Studio, please share your knowledge. The project is sort of "ready to be debugged executable reference".

  1. Now you can stop the debugger, save the solution in the same place where you have your development solution, to make sure that all relative paths are the same and open the solution in a text editor.
  2. In case your development project has the same name as the executable that that project generates and that you used in point 1, you need to change the name let's say adding 0. Make sure the file YourApp0.exe actually exists in that location. Otherwise, the project won't load. Another thing to remember, even though the name here is YourApp0.exe, the executable that will start is specified by Executable property.

Project("{911E67C6-3D85-4FCE-B560-20A9C3E3FF48}") = "YourApp0", "YourApp\bin\x64\Debug\net8.0\YourApp0.exe", "{0652E91E-CB29-4889-BB9C-E76CC72A064F}"

  1. Now you can open that solution in Visual Studio and add your development project. I assume the name of the project will be YourApp, that is why you needed to change the name in the point 3. Don't forget to add all projects your main project depends on.
  2. Save the solution and open it in a text editor again. Now you can copy the project block specifying YourApp0.exe as many times as you need the debugging sessions with different command lines. Increment initial 0 for each of your copies and generate new GUID for {0652E91E-CB29-4889-BB9C-E76CC72A064F}. Copy the related blocks in the GlobalSection of the solution file.
  3. Now the solution file is mostly ready, you can open it in Visual Studio again. In my case I had to change debugging properties of the executables to be "Managed (.NET Core, .NET 5+)". Then, you can update command lines in the executable projects as you need.
  4. At this point everything is ready for debugging. Put breakpoints to your source code as you normally do, start as many executable projects with Debug > Start New Instance as you need.

Then you can create different configurations of this very solution for Debug/Release or other conditions or different solutions. For automatic starting of the debugger for many instances use solution "Multiple startup projects".

Reasons:
  • Whitelisted phrase (-2): I figured out
  • RegEx Blacklisted phrase (2.5): please share your know
  • Long answer (-1):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: Alex