0
votes

We use TFS-online but have a local build server which defaulted to two build agents when we set it up. Our app is set for continuous builds on check-in.

We found that when building packages the two agents had their own independent build number sequences, so that when agent1 ran it would save our package to NuGet as something like 1.2.3.37032 and then agent2 ran it would create a package 1.2.3.29321

Hence our deployment server was picking an older build when updating the application.

I realise we should also increment the version number e.g. 1.2.4 each time as well, but for every single check-in that's rather laborious.

For now we have had to disable one build agent to prevent this - is there a better way to do this, or a way to ensure the build numbers are sequential?

2

2 Answers

1
votes

You can aslo use build number template to ensure the build numbers are sequential. The build number is set using the build number template that you specify in the Build Definition. When editing your Build Definition, go to the Process tab ->Advanced->Build number format field and you can customize what you want the build numbers to look like.

Use the Format String as below:

$(BuildDefinitionName)_1.2.$(DayofYear)$(Rev:.r)

Preview:Project_1.2.11.16

$(BuildDefinitionName) the name of build definition

1.2 Major version, since it upgrade less frequently, you can change it manually.

$(DayofYear) The day of year on which the build is created

$(Rev:.r) 16 an auto-incremented value for the numerical part of all builds that match the build number with at least the number of specified digits (The next build on this day will be 17,and so on)

0
votes

Turns out the simplest solution is to change the versioning scheme from a three-part one to a two-part one, e.g. 1.2.* instead of 1.2.3.* - thanks to the support team at Octopus Deploy

This will mean builds will be created in the form 1.2.{build}.{release}. The {build} increments daily, and the {release} increments according to the current date & time.

More info at Microsoft.

So now the builds look like this: 1.2.5733.12345