A personal repository of technical notes. - CSC

Debug Console Application When Started Outside of Visual Studio

Problem

Need to be able to debug a console application when the executable is started outside of Visual Studio. When doing this with a web application, you attach to process aspnet_wp.exe. This will not work with a console application.

Solution

Manually start debugger inside console application. Temporarily add the following line to the console application code:

System.Diagnostics.Debugger.Launch();

Running the console application executable will cause a prompt from Visual Studio Just-In-Time Debugger. At that time you may select Visual Studio from list of Possible Debuggers.

No comments:

Post a Comment