Check if IDE is open
-
Good Morning, After searching for 3 seconds I gave up hope and started praying that someone else will be able to help me. Can anyone tell me how to see if the IDE is open through code? I want to skip some code if the program is running in Debug mode through the IDE, but run the code if the program runs on a customer workstation. At the moment I'm using #Define, but this generally end up being forgotten when going into a Live environment. Regards,
-
Good Morning, After searching for 3 seconds I gave up hope and started praying that someone else will be able to help me. Can anyone tell me how to see if the IDE is open through code? I want to skip some code if the program is running in Debug mode through the IDE, but run the code if the program runs on a customer workstation. At the moment I'm using #Define, but this generally end up being forgotten when going into a Live environment. Regards,
You can use
#if DEBUG
to check whether the program is running on debug mode. When you release the application in release mode, all the code written inside this will be skipped.#if DEBUG
Console.WriteLine("running on debug");
#endifAll C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions