![]() |
Build number
What is the best way to record build number of your program in MSVC ?
I think build number stands for how many times you have build your project. It is stated in some programs, like version 3.4, build 1234. IMHO it is better than date, 'cause it is automatical and it is also good for you to not lost in your project. So anyb knows how to do it ? Or is there some option in MSVC which does that for you ? I once made some program which increased some number in file, and was executed everytime i pressed build in MSVC. But i think there is a better way to do it. |
Re: Build number
"I once made some program which increased some number in file, and was executed everytime i pressed build in MSVC. But i think there is a better way to do it."
I think that is the only way to have an automated build version number. Visual Studio doesn't have this as a built in feature. You could make a batch file that creates a .h file with the version number in it, then include that .h file in your source code when building the executable. The problem with this is that MSVC will always want to rebuild the executable each time that .h file it changed (because the date of the .h file is more recent than the date of the .exe file since the custom build steps only run AFTER the .exe file has been generated). You will need to set the date of the .h file back to BEFORE the date of the .exe (or the .cpp files). You can create a little utility that generates this .h file and sets the modification date/time back to something in the past (before the .cpp and .exe files). botman |
Re: Build number
or use this one, which is adapted from the Quake source code:
Code:
unsigned short CGeneral::GetBuildNumber() |
Re: Build number
I made my own program which will increase build number and store date and time of the last build in xml file. It also has history of all builds.
Program also creates .h file, so you can use build number/date/time in your program. It supports multi-project workspace/solution and several configurations (debug/release) It can be easily implemented in MSVC .NET, because .NET has pre-build setup. So it will launch before compiling, so no problems with time attributes for .h file. You just have to compile it and add this to pre-build line of your program : $(SolutionDir)buildnum.exe $(SolutionDir)build.xml $(SolutionName) $(ProjectName) $(ConfigurationName) ..\path\to\h\build.h program is very simple, one .cpp file. Download it here It is also using my XML parser, so it is good as an example for it. resulting xml file can look like this : Code:
<?xml version="1.0" encoding="UTF-8" ?> Code:
// koraXs build number logger 1.0 |
Re: Build number
euhm, i just manually update the build number. This is because i do not want it to be increased everytime i compile (build) something. THis is insane, sometimes i fix something and hit build to verify...
|
Re: Build number
I did that too but my lazyness caused that I quite early lost track of my program versions, as I backup them a lot.
And I usually code in debug mode and switch to release when I think I done everything I wanted |
All times are GMT +2. The time now is 01:02. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.