#if DEBUG Always True for DEBUG and RELEASE modes

For some reason, any code, for example:

#if DEBUG
    CallSomeMethod();
#endif

Always true, regardless of debug or release mode. Any ideas why and what settings I can use to enable or disable the feature? For the project, set the DEBUG constant to true.

Thank.

+4
source share
4 answers

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

enter image description here

+11

, :

DEBUG true.

, .

+5

, DEBUG .

- . , "" "" ( ).

0

#if DEBUG, , , , IDE. , , , @ DEBUG - , .

0

All Articles