0

We have a build issue on my team. Whenever we release a new version, we need to go through the code in several places and update the version number. This is time consuming and error prone. We need the version updated: - in a global variable - in a post-build command - in a resource .rc file

Is there any way to inject the version number into the process so that we might only have to update once? We build releases right from Visual Studio.

Thanks.

TheBranch
  • 93
  • 2
  • 7
  • Can you add some clarity? Are you saying you need to update the version(s) in the `VS_VERSION_INFO` resource in your `.rc` file(s), as well as in other places in your code? And is this something you *must* do as a post-build command, or can you not just `#define` the version number(s) in a global header (included by the resource compiler)? – Adrian Mole Apr 30 '20 at 18:33

1 Answers1

0

This could be something easy or harder to implement, depending on your project. For me it is not clear how you store your version number. This article or this question might provide an answer.

  • Thanks for the replies! I found a website that was very helpful: https://www.zachburlingame.com/2011/02/versioning-a-native-cc-binary-with-visual-studio/ So what I did was create a single Version header file. I defined my version and the date in every form that I needed it, and then I included that header and used it to populate the version everywhere that I needed it, as well as in the resource files. The only thing left is to see if I can use the header file to also add a version to one of our custom build step commands... – TheBranch Apr 30 '20 at 20:06
  • Can anyone point me to a resource on how I can define a variable and then use it in a post-build step? Essentially like we do for $OutDir macros, etc... – TheBranch Apr 30 '20 at 20:20
  • I suggest you could refer to the link: https://www.codeproject.com/Articles/5851/Versioning-Controlled-Build – Jeaninez - MSFT May 14 '20 at 08:51