#if DEBUG Always True for DEBUG and RELEASE modes

Viewed 5111

For some reason, Any code like:

#if DEBUG
    CallSomeMethod();
#endif

Is always true regardless of debug or release mode. Any ideas why, and what setting I can use to turn the feature on or off? For the project, define DEBUG constant is set to true.

Thanks.

5 Answers

None of the above worked for me. In my case, someone had set the configurations of all projects to point to debug. I reverted the changes and it worked. So if the above solutions do not work for you, check your Configuration Manager and verify that the Configuration is set correctly. enter image description here

Related