7

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)

LMB
  • 1,137
  • 7
  • 23

2 Answers2

16

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
starian chen-MSFT
  • 33,174
  • 2
  • 29
  • 53
3

Under your build definition you can customize the build name (Build number format):

For example, I added the date variable $(Date:dd.MM.yyyy) with a specific format to the field Build number format:

Build number format

Microsoft Docs, reference article

Adrian
  • 807
  • 2
  • 12
  • 25