Link to home
Start Free TrialLog in
Avatar of Kalpesh Chhatrala
Kalpesh ChhatralaFlag for India

asked on

Running in IDE or EXE in C# VS 2010

How can We Find Code is executed from IDE or EXE ?

thanks
Avatar of viralypatel
viralypatel
Flag of India image

check task manager .. if the process for your exe says

exename.vshost.exe (it is run from your IDE)

if it says just exename.exe (it is run directly using the exe)
Avatar of Kalpesh Chhatrala

ASKER

but i wan to check inside from application not from task manager.
get the list of all running process using this:
http://www.howtogeek.com/howto/programming/get-a-list-of-running-processes-in-c/

and check for exename.vshost.exe in the list.
but how can i match myapplcation exe with process list.

or is any another way ?
ASKER CERTIFIED SOLUTION
Avatar of ubound
ubound

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
or just check debugger.isattached
The way most people do it is with the following property:
// Sample for the Environment.UserInteractive property
using System;

class Sample 
{
    public static void Main() 
    {
    Console.WriteLine();
    Console.WriteLine("UserInteractive: {0}", Environment.UserInteractive);
    }
}
/*
This example produces the following results:

UserInteractive: True
*/

Open in new window

Thanks