Best way to detect a release build from a debug build? .net
Specifically, like this in C#:
#if (DEBUG)
Debug Stuff
#endif
C# has the following preprocessor directives:
#if
#else
#elif // Else If
#endif
#define
#undef // Undefine
#warning // Causes the preprocessor to fire warning
#error // Causes the preprocessor to fire a fatal error
#line // Lets the preprocessor know where this source line came from
#region // Codefolding
#endregion
if (System.Diagnostics.Debugger.IsAttached)
{
// Do this
}
else
{
// Do that
}
I should had used google.
#if DEBUG
Console.WriteLine("Debug mode.")
#else
Console.WriteLine("Release mode.")
#endif
Make sure that the option "Configuration settings" -> "Build" "Define DEBUG constant" in the project properties is checked.