#if DEBUG Always True for DEBUG and RELEASE modes

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


You should be able to select the release mode in your project properties. Right click your project, select Properties and click the build tab on the left of the window. From there, you can uncheck the "define DEBUG constant" box. Make sure you do this for the release build, and not the debug mode.

enter image description here


Seems like you're answering your own question:

For the project, define DEBUG constant is set to true.

This should only be set conditionally in the build file, and not always.