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

Arnold Wiegert 21 Reputation points
2022-10-28T20:51:28.91+00:00

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

C++
C++
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.
2,906 questions
{count} votes

Accepted answer
  1. RLWA32 32,146 Reputation points
    2022-10-29T10:36:48.277+00:00

    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 -

    255220-prebuild.png

    Batch build the solution -

    255314-batchbuild.png

    0 comments No comments

4 additional answers

Sort by: Most helpful
  1. Arnold Wiegert 21 Reputation points
    2022-10-30T19:57:32.77+00:00

    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
    2022-11-02T17:41:03.53+00:00

    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
    2022-11-06T18:51:21.323+00:00

    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
    2022-11-08T15:11:32.897+00:00

    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