PC Review


Reply
Thread Tools Rate Thread

Determine if program is running in Visual Studio IDE

 
 
Rob Nicholson
Guest
Posts: n/a
 
      12th May 2004
How do you determine if a program is running in the Visual Studio
IDE/debugger as opposed to standalone? We often include support files in the
same folder as the executable and would so something like:

Dim SupportFile As String
SupportFile = Application.StartupPath & "\SupportFile.txt"

But of course this fails when running in the IDE as the executable is in the
BIN folder so we need to do something like this:

Readonly Property SupportFilesPath() As String
Get
If IsIde() Then
SupportFilesPath = Application.StartupPath & "..\"
Else
SupportFilesPath = Application.StartupPath & "\"
End If
End Get
End Property

Need to implement that IsIde() function/property...

Thanks, Rob.


 
Reply With Quote
 
 
 
 
Éric Moreau
Guest
Posts: n/a
 
      12th May 2004
system.diagnostics.debugger.isattached

--

HTH

Éric Moreau, MCSD
Conseiller Principal / Senior Consultant
Concept S2i inc.(www.s2i.com)


"Rob Nicholson" <rob.nicholson@NOSPAM_informed-direct.com> wrote in message
news:%23Gbgt7$(E-Mail Removed)...
> How do you determine if a program is running in the Visual Studio
> IDE/debugger as opposed to standalone? We often include support files in

the
> same folder as the executable and would so something like:
>
> Dim SupportFile As String
> SupportFile = Application.StartupPath & "\SupportFile.txt"
>
> But of course this fails when running in the IDE as the executable is in

the
> BIN folder so we need to do something like this:
>
> Readonly Property SupportFilesPath() As String
> Get
> If IsIde() Then
> SupportFilesPath = Application.StartupPath & "..\"
> Else
> SupportFilesPath = Application.StartupPath & "\"
> End If
> End Get
> End Property
>
> Need to implement that IsIde() function/property...
>
> Thanks, Rob.
>
>



 
Reply With Quote
 
=?Utf-8?B?QW5hbmRbTVZQfQ==?=
Guest
Posts: n/a
 
      12th May 2004
Maybe this will help:
http://www.dotnet247.com/247referenc...48/240629.aspx

Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com

"Rob Nicholson" wrote:

> How do you determine if a program is running in the Visual Studio
> IDE/debugger as opposed to standalone? We often include support files in the
> same folder as the executable and would so something like:
>
> Dim SupportFile As String
> SupportFile = Application.StartupPath & "\SupportFile.txt"
>
> But of course this fails when running in the IDE as the executable is in the
> BIN folder so we need to do something like this:
>
> Readonly Property SupportFilesPath() As String
> Get
> If IsIde() Then
> SupportFilesPath = Application.StartupPath & "..\"
> Else
> SupportFilesPath = Application.StartupPath & "\"
> End If
> End Get
> End Property
>
> Need to implement that IsIde() function/property...
>
> Thanks, Rob.
>
>
>

 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      12th May 2004
Rob Nicholson schrieb:
> How do you determine if a program is running in the Visual Studio
> IDE/debugger as opposed to standalone? We often include support files in the
> same folder as the executable and would so something like:


You may want to experiment with:

\\\
#If Debug Then
Console.WriteLine("Debug mode.")
#Else
Console.WriteLine("Release mode.")
#End If
///

You can check if a debugger is attached by calling
'System.Diagnostics.Debugger.IsAttached'. I think that's more what you
want to find out than checking the 'DEBUG' constant.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to take an IE rendered screenshot of a website with visual studio .net 2002 or visual stuido .net 2003? I can't install visual studio .net 2005 on this computer. Daniel Microsoft C# .NET 0 14th May 2007 07:45 PM
Determine if WebApp was Launched from Visual Studio Tyrant Mikey Microsoft ASP .NET 2 27th Sep 2005 04:01 PM
Running program without visual studio.net Cinta Microsoft VB .NET 2 17th Feb 2005 04:28 PM
IE Window Title | Visual Studio .NET 2003 (Visual C++ only) not running Anonymous Windows XP Internet Explorer 1 17th Jul 2004 08:02 PM
Determine whether App is running is Visual Studio cody Microsoft C# .NET 14 19th Apr 2004 03:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:51 PM.