all groups > dotnet windows forms > february 2006 >
You're in the

dotnet windows forms

group:

Determine running from IDE


Re: Determine running from IDE Jim Hughes
2/27/2006 9:43:57 PM
dotnet windows forms:
If DesignMode Then

Else

End If

[quoted text, click to view]

Determine running from IDE Jared
2/28/2006 12:00:00 AM
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?

Re: Determine running from IDE Stoitcho Goutsev (100)
2/28/2006 9:23:51 AM
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.


--
HTH
Stoitcho Goutsev (100)

[quoted text, click to view]

Re: Determine running from IDE Patrice
2/28/2006 3:59:36 PM
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" ?

--
Patrice

"Jared" <jared@paradigmitz.net.au> a écrit dans le message de
news:%23gV$mXCPGHA.1088@tk2msftngp13.phx.gbl...
[quoted text, click to view]

Re: Determine running from IDE Herfried K. Wagner [MVP]
2/28/2006 11:08:10 PM
"Jared" <jared@paradigmitz.net.au> schrieb:
[quoted text, click to view]

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'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
Re: Determine running from IDE Jared
3/1/2006 12:00:00 AM
Closest to a solution, but would like something that would work even if i
gave client a debug version.

AddThis Social Bookmark Button