I'm using VB Express 2008. I know how to tell if code was built in debug more or release, but now I would like know how to tell if it is running in the Visual Studio IDE or not (so that I can add some debug MsgBox() and not worry about them showing if I ever accidentally ship a debug version).
A:
If you're building for Test and Prod, consider using a preprocessor directive in your code.
#If DEBUG Then
MsgBox("Foo")
#End If
This falls down, of course, if you ship a debug-built binary to a non-dev environment. I understand this is attacking the problem from another angle from where you asked the question (the IDE).
p.campbell
2010-09-02 02:48:35
+1
A:
Try checking the IsAttached property of System.Diagnostics.Debugger
Jorgen Thelin
2010-09-02 03:01:24
sorry, but @guy beat to to it by one minute (+1, though)
LeonixSolutions
2010-09-08 04:12:10