Keyboard:  CTRL + SHIFT + O
Menu:  File -> Open Project/Solution; File -> Add -> New Project
Versions:  2008,2010
Published:  10/27/2010
Code:  vstipDebug0034

 

 

Okay, so the full title here is "Debug Your Executable Without Using the Traditional 'Attach to Process' Menu Items"  but that was way too long for me so I just shortened it up a bit.  You probably already know about the Attach to Process menu items on the Debug and Tools menus, but what if, for example, the process fails before you can attach to it?  Maybe it fails on startup or it runs too fast for you to catch it.  Well we have a solution for you--literally!  Did you know you can create a Solution for executables?

 

It's easy to do, just find the executable you want to create a solution for by going to File -> Open Project/Solution:

image

 

 

Or, if you have a Solution open already, File -> Add -> Existing Project:

image

 

 

Now you can run the executable just like any other project by pressing F5.  If you have multiple projects make sure to set it as the startup:

image

 

 

NOTE:  When you are debugging an executable without the source code, the available debugging features are limited, whether you attach to a running executable or add the executable to a Visual Studio solution. If the executable was built without debug information in a compatible format, available features are further limited. If you have the source code, the best approach is to import the source code into Visual Studio and create a debug build of the executable in Visual Studio.