Reputation: 115
To achieve CI/CD am using VSTS, now am stuck at a point where i am supposed to increase the version numbers for every new build queued.
Is it possible to update the revision number of each project outputs (dll's or exe's) just by adding one more task in build definition or any msbuild arguments are available to change the version numbers in run time.
Thanks in advance.
Upvotes: 0
Views: 3101
Reputation: 825
BuildNumbers are automatically created against every build that gets scheduled.
You specify what you want this to be in the Build>Options>Build number format section.
Default value is:
$(date:yyyyMMdd)$(rev:.r)
But if you add some variables into your build then you can alter the format as such.
$(MajorVersion).$(MinorVersion)-$(date:MMdd)$(rev:.r)
This then get's passed through to your release step as the pre-defined variable
$[BUILD_BUILDNUMBER] - TFS 2010/15/17 Update1
$(Build.BuildNumber) changed from old $[BUILD_BUILDNUMBER] for Update2
More info on build numbers and variables can be found here:
Edits:
Yes you may add versioning to DLL's too. We use a a stock Microsoft Powershell script which does the trick, that we add as a build task (before the build solution step), the source can be found here:
This doesn't require any arguments as it uses the variables from the build process!
Upvotes: 4