Way to determine whether executing in IDE or not?

CJ7 picture CJ7 · Mar 8, 2013 · Viewed 7.9k times · Source

In C#/VB in Visual Studio 2010, is there way in the code to determine whether the program is currently running in the IDE or not?

eg. If ProgramRunningInIDE Then MessageBox.Show exc.Message

Answer

Morrison Cole picture Morrison Cole · Mar 8, 2013

You could check if the debugger is attached with:

System.Diagnostics.Debugger.IsAttached

This essentially does the same thing.