Determine running from IDE

  • Thread starter Thread starter Jared
  • Start date Start date
J

Jared

Hi,

I would like to write a line of code which will get used in several
debugging points, to look like this..

If app.Mode = IDE then Stop Else End

Or if Stopped ended an EXE mode that would be good.

Application.StartupPath?
 
That can be discovered only for Component - classes that derive from
Component or classes that implement IComponent. In the latter case this
information can be obtained by the component site (ISite) if set.

Either way you are looking for the DesignMode porperty. This property is
implemented as protected property in the Component class which in turn uses
the DesignMode property of the ISite interface.

For the rest of the types I don't think you can make this discovery.
 
You could perhaps base this on the build mode (debug or release ?) or
depending on wether or not you have a debugger attached rather than just
"running from the IDE" ?
 
Jared said:
I would like to write a line of code which will get used in several
debugging points, to look like this..

If app.Mode = IDE then Stop Else End

Maybe the following solutions fit your requirements:

\\\
#If DEBUG Then
Console.WriteLine("Debug mode.")
#Else
Console.WriteLine("Release mode.")
#End If
///

Make sure that the option "Configuration settings" -> "Build" "Define DEBUG
constant" in the project properties is checked.

- and/or -

You can check if a debugger is attached:
'System.Diagnostics.Debugger.IsAttached'.
 
Closest to a solution, but would like something that would work even if i
gave client a debug version.
 
Back
Top