Home All Groups Group Topic Archive Search About

Running from the IDE, or not?

Author
17 Feb 2006 9:07 PM
mikeb
I've tried about every search I can think of, but not finding the answer.  I
found it before... somehow.

How, in code (VB particularly), can you test whether your app is running
from the IDE or via a stand alone exe?

Author
17 Feb 2006 9:59 PM
AMercer
> How, in code (VB particularly), can you test whether your app is running
> from the IDE or via a stand alone exe?

A decent hack at it is
   Diagnostics.Debugger.IsAttached()
It is true if running from the IDE, and it is false if run standalone
without using some other debugger.
Author
17 Feb 2006 10:28 PM
mikeb
Perfect - that does it.

For the sake of better understanding this stuff - where do you find such
information?  My searches gave me nothing near this.

Thanks!


Show quote
"AMercer" <AMer***@discussions.microsoft.com> wrote in message
news:A0CC6D94-6A48-48FB-A3F0-C9D46E5ECF6C@microsoft.com...
>> How, in code (VB particularly), can you test whether your app is running
>> from the IDE or via a stand alone exe?
>
> A decent hack at it is
>   Diagnostics.Debugger.IsAttached()
> It is true if running from the IDE, and it is false if run standalone
> without using some other debugger.
Author
17 Feb 2006 11:10 PM
AMercer
> For the sake of better understanding this stuff - where do you find such
> information?  My searches gave me nothing near this.

I remembered IsAttached from having read about it a year or two ago.  I
found it the hard way, by browsing the .net class library documentation (it
comes with .net and it is available in MS's web site).  No search helped me
on this question, but often searches are helpful.

In this case, your question and mindset was about 'am i running in the ide',
not 'am i running under a debugger'.  If you had managed to phrase the
question in terms of a debugger, a search would probably have been
productive.  That's not an easy thing to do, but it gets easier the more
reading you do.  So, browse the documentation.

AddThis Social Bookmark Button