0

I've followed the GitVersion instructions for TeamCity and what that gives me is a build number like this:

enter image description here

This is nearly perfect, except that occasionally (for example if I re-run the build manually), GitVersion computes the exact same build number so I get multiple builds with the same build number, like this:
enter image description here

What I want to happen is to have an auto-incrementing build number in the metadata, like this: #0.1.0-alpha.6+1, #0.1.0-alpha.6+2, etc.

I know this must be possible, because the GitVersion project shows it in a screen shot right on GitHub: enter image description here

I found mention of a setting update-build-number in the GitVersion docs, and I set that to true, but it makes no difference. How do I make GitVersion add that build metadata?

Tim Long
  • 13,508
  • 19
  • 79
  • 147
  • 1
    Tagging it with build meta will not help, because build meta is explicitly ignored when calculating precedence. Your build system is broken. No two builds should ever produce the same version, unless they can exactly duplicate the previous build, which is virtually impossible with most tool chains today, even when the source has not been modified. – jwdonahue Feb 05 '21 at 00:25
  • @jwdonahue I understand that build metadata is ignored for the purposes of comparing and sorting versions and I'm fine with that, but there is a reason it exists and I want it to show up in TeamCity. I'm fine with the version-per-commit strategy. I'm not that worried worried that two integration builds could have the same SemVer on the build server, the purpose of those is mainly to ensure that the unit tests pass. I just want to get the build number to show up as it does in the screen shot. – Tim Long Feb 09 '21 at 11:13

0 Answers0