How to give 32& 64-bit versions the same version #

Arnold Wiegert 21 Reputation points

I have a MSVC solution set up to produce both a 32 & 64-bit version of an app.
I also have a utility which can update the project's version information in the main solution's *.rc file.

This update is handled in a pre-build step, which can only be enabled for one or the other of the 32 or 64-bit configurations.
Currently, I have to make sure that the 2 configurations are executed in the correct sequence with the pre-build step disabled for one of the 2 configurations, to avoid giving each a different, consecutively numbered version of the type 1.3.45 & 1.3.46

What I need to figure out is how to make sure this version update is only executed once per release cycle so that both the 32 & 64-bit executables will have the same version information baked in.

My current thinking is that I might have a separate 'publish' project which updates the version number and then causes both 32 & 64-bit configurations to be cleaned, compiled and linked, using the same RC file, initiated by a dependency of this project on the 2 executables.
But I have no idea whether this is even feasible and much less how to even try and go about doing so.
Any pointers or hints will be most appreciated
All my searching has been complicated because all results are always overrun by answers about how to set up dependencies within a single project. I am quite familiar with that

A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,629 questions
{count} votes

Accepted answer
  1. RLWA32 43,051 Reputation points

    One way would be to create a sentinel file in the pre-build event when updating the .rc file and include a test for the file's existence in the event. When you want to increment version numbers delete the sentinel file before building.

    For example -


    Batch build the solution -


    0 comments No comments

4 additional answers

Sort by: Most helpful
  1. Arnold Wiegert 21 Reputation points

    Currently I am using the pre-build step to update the RC file and, as you mention I could create a sentinel file.

    My real problem is still how can I from within one sub-project of a solution initiate, if necessary, the compile of the 2 dependent release configuration for 32 & 64-bit of the main excutable, which would then, in a post-build step, become part of an installer file, one for each 32 & 64 bit configuration

    I can see all sorts of scripts or steps to execute, but i cannot see how from any script, batch or some other language( Perl/Python) I can start the compile of any specific sub-project of a solution

  2. Arnold Wiegert 21 Reputation points

    From where I sit, the answer I got, addresses a different issue.
    If it does address my question & I misunderstood, then please add the necessary details.
    I am familiar enough with MSVC to be able to create sentinel files, and the answer does not address the original question: How to give 32& 64-bit versions the same version #

    What it seems I need, and something I have no idea how to do, would be have a sub-project which as part of any one of the available steps, gets MSVC to

    1. create a new version number
    2. ask MSVC to compile and link both release versions (32 & 64-bit) of the main project
    3. possibly compile the help file
    4. possibly initiate producing an installer

    steps 2 is the one where I am stuck.

    One option I have considered, would be to find a way to invoke MSVC from the command line from another script.

    But, if I have to go that far, I might as well consider some version of a CMake project for that part of my problem and only use MSVC for debugging.

  3. Arnold Wiegert 21 Reputation points

    Quite evidently, I did not understand your answer and am not sure even now that I do.
    I suppose the real mystery (and solution) is tucked away in that batch file. But, does that batch file invoke MSVC or is internal, i.e. part of the build-step.

    I have thought about this problem some more and think I might have a different solution, but due to other priorities I have not yet been able to test it.

    But, without more specifics about your batch file, I am still unsure of how it does what your screen shots show it doing.
    My apologies for being too dense to comprehend.

  4. Arnold Wiegert 21 Reputation points

    Thank you, I think I finally read your answer more carefully and realized that you recommended a batch build.
    That is not something I had been doing previously except when building some multi-library support code, but I agree that it will solve my problem.

    0 comments No comments