How to Compare Visual Studio’s Debug and Release Configurations

Comparing Debug and Release configurations (or any other two configurations) is not easily done with visual studio.  However, there is a way to do it reasonably easily, since all the configurations setting  applied to a C++ project are translated to command line switches passed  on to the compiler or linker tools.
This method  allows easy comparison of the command line switches  of two configurations.

1. Open the Project properties and navigate to the Command Line entry:
Project –> Properties –> C/C++ –> Command Line
Select one of the configurations you  want to compare
Merge Release Property Pages

2.  Open an empty  text document in  a text editor supporting regular expressions. I’ve used Notepad++,  but you can also use Visual Studio itself by opening a new text file.
Paste the content of the All Option field  to the file. Append the  content of the Additional Options Field.

you should be getting something similar to this (word wrap view) :

3. The next steps will ensure there is  one option per line.  Most of the switches  have no spaces except  the /D switch.  I’ll remove it with a simple regex :
Search and Replace the regular expression
/D\s  with  /D   :

4.  Now  we can have one option per line  by searching and replacing \s  with \n   (spaces to newlines).

5.  Save the output to a file (e.g.  OptionsReleaseSplit.txt)
E__Examples_OptionsReleaseSplit.txt - Notepad

6.  Repeat the process to the other configuration you want to compare.

7.  Now comparing the two configurations is as easy as comparing the two files in a  Diff  tool :

A similar method can be applied to the linker’s options:
Merge Property Pages

That’s it,  the simple system saved me some guesswork when a project compiled in debug but will not compile (or link)  when using release configuration.
Do you have other ways of   comparing debug/release?    leave a note in the comment section.

Leave a Reply

Your email address will not be published. Required fields are marked *