Search code examples
tfsbuild-definitionvnext

Revision number is not updated properly in VNext builds


Working with Gated/CI build definition (vNext) in TFS2017, the revision number is not increased correctly. Each build has the same Rev number even the changes are checked-in properly.

I get the revision number from $Env:BUILD_BUILDNUMBER via powershell at the beginning of the build process and it always returns the same number.


Solution

  • Make sure you are using the $(Rev:.r) token in the Build number format setting.

    Build number format:

    Use $(Rev:.r) to ensure that every completed build has a unique name. When a build is completed, if nothing else in the build number has changed, the Rev integer value is incremented by one.

    If you want to show prefix zeros in the number, you can add additional 'r' characters. For example, specify $(rev:.rr) if you want the Rev number to begin with 01, 02, and so on.

    Also make sure the build number was not updated with the permanent number or string. (There is a possibility that used a script to customize your build process that updated the build number)


    UPDATE1:

    Please note that if the Major build number is changed in Build number format, then the revision number will not be changed. The Revision number only incremented when the Major part is not changed.

    BTW, the token $(rev:.rr) should be used such as a variable, so the build number format should be something like : Test DEV CI_Rev.$(rev:.rr) in your scenario.


    UPDATE2:

    In your scenario you updated the build number with the assembly info every time. So, if the assembly info is different every time, then the revision number will no be changed, that's the expected behavior.

    enter image description here