c++cvisual-studio-2008build-automation

How to Increment Visual Studio build number using C++?


I have a Visual Studio 2008 project that produces a file called: "Game-Release.exe".

This was configured under Project Properties -> C/C++ -> Linker -> General:

$(OutDir)\$(ProjectName)-Release.exe

I would like to take this a bit further by have an incrementing build number so I would have something which says:

Game-Release-Build-1002.exe

The number on the end should be an incrementing integer. I will be storing the build exe's on subversion so I think i would find this useful (although not necessary).

Perhaps there is a built in macro in Visual Studio that could handle this. Quite possibly I was thinking I could have a text file with the build number in it and have the compiler read, use and increment the number in the file each time the project is built. My goal is however to make the process as automated as possible. What is the best way to accomplish this?

If you offer an opinion, please also provide the code we can all share. Thnx.


Solution

  • The Versioning Controlled Build add-in seems like it would do the job.

    Update: Your question specifically mentions using Visual Studio to increment the version, but there is nothing automated about that. Have you considered using Nant and a CI server? That way, it is easy to inject the SVN revision number into AssemblyInfo.cs equivalent for C++. Automatically, on the build server.