views:

512

answers:

2

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?

+2  A: 

Any chance you have DEBUG defined for both Debug and Release configurations?

Si
ah yes that was it! Silly me. thanks!
Tone
A: 

Do you have a "#define DEBUG" line ? That sets DEBUG to true always.

CmdrTallen