Hi all!
Does anyone know if its possible to detect if a C# program is running from the IDE and if so can anyone explain how it can be done?
Cheers,
Ryan Jones
Hi all!
Does anyone know if its possible to detect if a C# program is running from the IDE and if so can anyone explain how it can be done?
Cheers,
Ryan Jones
You would use preprocessor directives.The DEBUG symbol is defined for a Debug build but by default it is not for a Release build. Note that the conditioon is not tested at run time. It is tested at compile time and only a section that evaluates to true will be compiled into the assembly. For more information see the link below.Code:#if DEBUG MessageBox.Show("Debugging"); // This line will be compiled into a Debug build. #else MessageBox.Show("Release"); // This line will be compiled into a Release build. #endif
http://msdn2.microsoft.com/en-us/library/4y6tbswk.aspx
2007-2013
Why is my data not saved to my database? | Communicating between multiple forms | MSDN Data Walkthroughs
MSDN "How Do I?" Videos: VB | C#
VBForums Database Development FAQ
My CodeBank Submissions: VB (*NEW* Pausing Code) | C#
My Blog: Using Parameters in ADO.NET | Keyboard Events | Assemblies & Namespaces
Ah great, that should work perfectly for what I need - thanks for the help!
Cheers,
Ryan Jones