How to make a program know if it is running inside VS2005 IDE?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all.

I am just wondering if there is a way to make a VB.Net program know
whether it is running from inside a Visual Studio 2005 IDE or a
compiled executable?

Thanks.
-CG
 
Hi all.

I am just wondering if there is a way to make a VB.Net program know
whether it is running from inside a Visual Studio 2005 IDE or a
compiled executable?


You can use this command:

System.Diagnostics.Process.GetCurrentProcess().ProcessName.ToLower =
"devenv"
 
You can use this command:

System.Diagnostics.Process.GetCurrentProcess().ProcessName.ToLower =
"devenv"


System.Diagnostics.Process.GetCurrentProcess().ProcessName does the
trick.

Thanks very much.
-CG
 
Hi all.

I am just wondering if there is a way to make a VB.Net program know
whether it is running from inside a Visual Studio 2005 IDE or a
compiled executable?

Thanks.
-CG
The one I use is -

System.Diagnostics.Debugger.IsAttached

The Debugger will only be Attached if running under the IDE.

ShaneO

There are 10 kinds of people - Those who understand Binary and those who
don't.
 
But surely that will only work in DEBUG mode & not RELEASE as it removes the
debugging info

|I am sure you can use a pre-processor to check this too. Something along the
lines of:

#If DEBUG Then
MessageBox.Show("Debug")
#Else
MessageBox.Show("Release")
#End If
 
Back
Top