#If compiler directive no longer recognizes DEBUG after changing solution to x64

I am using Visual Studio 2010 C #.

I recently changed all projects in an x64 solution using the configuration manager in addition to changing the assembly properties for all projects. Since then, the #if (DEBUG) directive does not work as if the DEBUG constant disappeared.

 #if (DEBUG) // This code does not execute even in debug mode! #endif 

I also noticed that instead of the usual bin\Debug and bin\Release folders, projects are now compiled to bin\x64\Debug and bin\x64\Release .

I searched, but most of the related results described how to configure x64 if it does not display by default.

+4
source share
1 answer

When creating your x64 platform, it is likely that your Debug settings for that platform do not define the DEBUG constant.

In the project properties, go to the x64 / Debug configuration / platform and check the "Build" tab. There is a checkbox "Define DEBUG constant". Make sure it is installed.

+14
source

All Articles