Is it possible to Rename or give a custom name to a Build in VSTS?

Question:

Is it possible to Rename or give a custom name to a Build in VSTS?

What I want to do is have my builds named after the version number. The version number is written in a .version file in the root directory.

The intended name would be: $(MyVersionNumber):$(Rev:rr)

Answer:

You can update the build number for current build through Logging Command (e.g. Write-Host "##vso[build.updatebuildnumber]buildnumber").

Simple workflow of your code:

  1. Include $(rev:.r) in default build number format (Options), for example: $(date:yyyyMMdd)-$(rev:.r)
  2. Get current build number from pre-defined variable (Build.BuildNumber/BUILD_BUILDNUMBER)
  3. Get the rev value from this build number in your code
  4. Read version number from .version file
  5. Update build number through Logging Command

Source:

Is it possible to Rename or give a custom name to a Build in VSTS? by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply