Conditional execution based on app configuration

  • Thread starter Thread starter John
  • Start date Start date
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
 
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.
 
yes


condition

# IF DEBUG THEN

# END IF

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

Michel
 
Back
Top