CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2011
    Location
    DeLand, FL
    Posts
    41

    VS2008: Detecting when running under IDE

    Guys ... is there any way for me to detect whether or not my code is running under the IDE? I.E.

    if (SomeNameSpace.IDE_Active())
    Console.WriteLine("Code is running in the IDE!");

    Thanks,

    -Max

  2. #2
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: VS2008: Detecting when running under IDE

    System.Diagnostics.Debugger.IsAttached
    Always use [code][/code] tags when posting code.

  3. #3
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: VS2008: Detecting when running under IDE

    I think you could also use Conditional Compilation logic here as well, something like :

    Code:
    #If Debug = True Then 
       'Code to fire WHILE debugging 
    #Else 
       'Code to fire IF NOT DEBUGGING
    #End If

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: VS2008: Detecting when running under IDE

    Quote Originally Posted by HanneSThEGreaT View Post
    I think you could also use Conditional Compilation logic here as well, something like :

    Code:
    #If Debug = True Then 
       'Code to fire WHILE debugging 
    #Else 
       'Code to fire IF NOT DEBUGGING
    #End If
    That means you are running under a debug build, but not necessarily under a debugger.

  5. #5
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Talking Re: VS2008: Detecting when running under IDE

    Quote Originally Posted by Arjay View Post
    That means you are running under a debug build, but not necessarily under a debugger.
    Oops What was I thinking! LOL!

  6. #6
    Join Date
    Feb 2011
    Location
    DeLand, FL
    Posts
    41

    Re: VS2008: Detecting when running under IDE

    Thanks guys ... will check it out.

    -Max

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured