473,320 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to determine if in developer IDE or stand-alone?

Tom
How can one determine if a .NET program is running in the developer IDE or
running stand-alone? I am sure I saw something somewhere but I don't
remember where or what.

Thanks!

Tom
Nov 20 '05 #1
4 1547
Tom wrote:
How can one determine if a .NET program is running in the developer IDE or
running stand-alone? I am sure I saw something somewhere but I don't
remember where or what.


Try the shared property:

System.Diagnostics.Debugger.IsAttached

Cheers

Arne Janning
Nov 20 '05 #2
Tom wrote:
How can one determine if a .NET program is running in the developer IDE or
running stand-alone? I am sure I saw something somewhere but I don't
remember where or what.


In VB6 I've been using, and it should work similarly from VB.NET:

Public Function IsRunFromIDE() As Boolean
Debug.Assert MakeTrue(IsRunFromIDE) Or True
End Function

Private Function MakeTrue(ByRef bItem As Boolean)
bItem = True
End Function
Nov 20 '05 #3
* "Tom" <to*@nospam.com> scripsit:
How can one determine if a .NET program is running in the developer IDE or
running stand-alone? I am sure I saw something somewhere but I don't
remember where or what.


See:

<URL:http://www.google.de/groups?threadm=%23O1GIqAOEHA.4036%40TK2MSFTNGP12.p hx.gbl>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4
None of the methods suggested will determine if you are started from the
IDE. You can come to the same conclusion by testing this code (perhaps in
page_load).

Debug.WriteLine("DebugWriteLine")
#If DEBUG Then
Debug.WriteLine("If Debug> DebugWriteLine")
#Else
Debug.WriteLine("Else Release> DebugWriteLine")
#End If
If System.Diagnostics.Debugger.IsAttached() Then
Debug.WriteLine("Debugger Is Attached")
Else
Debug.WriteLine("Debugger Is Not Attached")
End If

If the project is in Debug mode, and started with F5, you get everything you
expect.

If the project is in Debug mode, and started with Ctrl-F5, you can still see
the debug output, but you have to use an external debug catcher (e.g.
dbgview from www.sysinternals.com). You get the output you expect.

If you set the project to Release mode, you get nothing, but only because I
used Debug.Writeline; your program would execute the #Else code.

So we still have the question how to determine if the IDE started the
program? Still looking.
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:2i************@uni-berlin.de...
* "Tom" <to*@nospam.com> scripsit:
How can one determine if a .NET program is running in the developer IDE or running stand-alone? I am sure I saw something somewhere but I don't
remember where or what.
See:

<URL:http://www.google.de/groups?threadm=...TK2MSFTNGP12.p
hx.gbl>
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: John Bentley | last post by:
John Bentley: INTRO The phrase "decimal number" within a programming context is ambiguous. It could refer to the decimal datatype or the related but separate concept of a generic decimal number....
18
by: Christopher W. Douglas | last post by:
I am writing a VB.NET application in Visual Studio 2003. I have written a method that handles several events, such as closing a form and changing the visible status of a form. I have some code...
20
by: Olav.NET | last post by:
I am a .NET/C++ developer who is supposed to do some work with Access. I do not know much about it except for the DB part. Questions: *1* I am looking for INTENSIVE books to get quickly up to...
12
by: clintonG | last post by:
I can't tell you how frustrated I get when going to a web developer's website and observing he or she is an idiot that has not grasped the most fundamental element of usability: page title naming...
19
by: John Bentley | last post by:
John Bentley: INTRO The phrase "decimal number" within a programming context is ambiguous. It could refer to the decimal datatype or the related but separate concept of a generic decimal number....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.