it always annoyed me that there's no built-in mechanism for automatic build versioning in visual studio, so here's my little "build number incrementor". usage:
buildno++.exe <filename>
i have it set up to run as a pre-build event in vs. a text file (called buildno.debug
in the screenshot) contains a single #define
:
#define BUILDNO 0
and every time the buildno++.exe
runs it increments that number in the file, whatever it happens to be.
you then #include
that file and can use the BUILDNO
macro to access the updated, current build number in your code. this is how i use it:
#ifdef DEBUG #include "buildno.debug" #define BUILD "debug build " STR(BUILDNO) #else #include "buildno.release" #define BUILD "build " STR(BUILDNO) #endif
note: the original filename is actually buildno++.exe
but the ++
part seems to have been stripped by discord. so rename accordingly.