Published on by

It has become increasingly hard to disable certain compiler options in recent versions of Visual Studio such as 2010. In case you haven't noticed in project properties under C/C++ General section option Debug Information Format you can only select between C7 Compatible (/Z7), Program Database (/Zi) and Program Database for Edit and Continue (/ZI) — there is no Disabled option in the drop list.

That is a WTF in itself for which Microsoft developers said "we are looking to fix this in future release", but fortunately there is a way around it:

  • Open project properties
  • Change Configuration to Release
  • Change Platform to All Platforms
  • Change Debug Information Format to C7 Compatible (/Z7)
  • Save all and close Visual Studio
  • Open .vcxproj file in your favorite text editor
  • Find all instances of <DebugInformationFormat>OldStyle</DebugInformationFormat> and replace them with <DebugInformationFormat></DebugInformationFormat>

That's it. You can now build your project in release mode without debug information as it was supposed to be built in the first place.