I’m using Visual Studio 2010 C#.
I recently changed all projects in a solution to x64 by using configuration manager in addition to changing the build properties for all projects. Since then, the #if (DEBUG) directive doesn’t work as if the DEBUG constant vanished.
#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, the projects now get compiled into bin\x64\Debug and bin\x64\Release.
I searched around but most related results covered how to configure x64 if it does not show by default.
When creating your x64 platform, it’s likely your Debug settings for that platform aren’t defining the
DEBUGconstant.In the project’s Properties, go to your x64/Debug configuration/platform, and check the “Build” tab. There is a check box called: “Define DEBUG constant”. Make sure it’s checked.