How do I attach Visual Studio to a process that is not started yet?

Actually you can; you don't attach to it, you start it. On the properties of your project, on the Debugging tab, specify the path of the program you want to attach to in the "Command" textbox.

You can also enter any command-line arguments for the program in the "Command Arguments" box:

enter image description here

Ensure that "Attach" is set to "No".


I was debugging a C++ plugin in an externally spawned process that crashed by throwing an exception at startup and this worked perfectly for me:

Add the free Reattach Extension for Visual Studio. Ask it to reattach to the process name before it is launched. It will pop a modal dialog saying it is waiting for the process name to launch.

Now launch the process and the Visual Studio debugger will attach immediately, catching exceptions and hitting breakpoints.


Follow these steps if you have Visual Studio 2017-2022:

  1. File > Open > Project/Solution
  2. Choose your .exe
  3. Debug > Start Debugging

You will have to tell Visual Studio where the debugging symbols are if it doesn't find them automatically.

This is easier than other suggestions: you don't have to mess with project properties, and no extensions are needed.