how to know when an app is running in the VS IDE

M

Mark

Is there a straight-forward way to know when an app is running in the VS IDE
(versus the EXE) ??

Thanks
 
A

AMDRIT

Mark,

Assemblies do not execute in the IDE like it seemed to do in VB4/5/6 days.
Even an uncommitted project will create a temporary assembly and execute
that. The IDE will hook into the executing assembly with tracelisteners and
other novel items from the system.diagnostics namespace.

Each assembly can be assigned a "Build Mode" (Release, Debug). You could
perhaps get away with just testing for that. Otherwise, look at the
application's tracelisteners, perhaps there is a way to determine it from
there.
 
G

Guest

Is there a straight-forward way to know when an app is running in the VS IDE
(versus the EXE) ??

If System.Diagnostics.Debugger.IsAttached is true, then you are running
under some debugger, possibly (probably?) the VS IDE.
 
K

Ken Halter

DHarry said:
Why not use arguments when you open your app with the IDE?!

fwiw, here's some code that involves setting the 'design time' command line
to some "extremely hard to type" argument and testing for that to "assume"
IDE... fwiw, I got those characters from the character map utility. They're
Chr$(&HEE), Chr$(&HD0) and Chr$(&HCA), in case people can't see them here,
they spell "IDE"
'======
Public Class Form1
Private mbRunningIDE As Boolean

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Command() = "îÐÊ" Then
mbRunningIDE = True
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
If mbRunningIDE Then
MsgBox("We're running in the IDE")
End If
End Sub
End Class
'======
 
M

Mark

Thanks for the suggestions everyone ... I was really hoping for something
simple like My.Application.IsRunningInIDE

Such is life ... :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top