Autoversioning in C ++ with Visual Studio 2008 and SVN

I use MS Visual Studio 2008 to do some C ++ development work, and currently we have a version function that returns a string encoded string representing the version number. I would like to find out a way so that instead of a hard coded number it starts with 1, and increases by 1 every time I make a debug or release assembly (or even better, track the debug version and release version numbers). Or, if this is not possible, use the current date / time as the version number.

Please note that since several people will work in the project, and with the help of SVN, the code must be computer independent (this means that if I am currently on version 100, the latest version of my colleague was in version 90, then the next one ( after I register the code and my colleague pulls out the code), the version number of his next compilation should be 101, not 91.)

Could you help me?

+4
source share
2 answers

If you use TortoiseSVN, you can use subwcrev.exe in the pre build event to write the current version number to the source file.

version.template.hpp -

  const string version = "13.12.0.$WCREV$";

subwcrev.exe "$(SolutionDir)." "$(ProjectDir)version.template.hpp" 
             "$(ProjectDir)version.hpp"

#include "version.hpp".

+6

(, ), Visual Studio /, script, , , hansmaad, , , , " ", , , SVN , . , SVN.

, ( ) ... , X, X + 1? . , , , , , , , . , Y Y .

, , , .

+2

All Articles