Conditional execution based on app configuration

J

John

Hi

Is there a way to check within app if the app is running in debug
configuration (or that it is running in IDE instead of standalone) and then
decide what code to execute?

Thanks

Regards
 
A

AMercer

You can tell if your program has a debugger attached (any debugger, not just
the IDE) by:

System.Diagnostics.Debugger.IsAttached()

You can tell if using the debug configuration by including the following in
a module:

#If DEBUG Then
Public DebugBuild As Boolean = True
#Else
Public DebugBuild As Boolean = false
#End If

In your code, you can access the public variable DebugBuild.
 
M

Michel Posseth [MCP]

yes


condition

# IF DEBUG THEN

# END IF

or the isdebugger atched method to check if running in the IDE

Michel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top