I seem to be having trouble with preprocessor directives in C#. I’ve created a Visual Studio 2008 C# win forms app. I add this:
#if (DEBUG) textBox1.Text = 'in debug mode'; #else textBox1.Text = 'in release mode'; #endif
And when I run in debug I see the expected ‘in debug mode’. However when I switch to Release, compile, and run the .exe, I still see the ‘in debug mode’ text. In my project properties I have Define DEBUG constant checked. I even get the correct color-coded syntax for the code above. What gives?
Any chance you have DEBUG defined for both Debug and Release configurations?