The semantic versioning used in all of our TFS/VSTS CI builds uses the predefined variable Build.BuildID
for the buildnumber portion of major.minor.revision.buildnumber
. The build id is used so we have traceability when troubleshooting. We can easily search for the build and see the associated changes. Major.minor.revision
is set in a variable group so it can be shared and updated in one place, across build definitions.
I set the version in the AssemblyInfo.cs file of all projects before compilation to version our assemblies. This is done via a simple PowerShell script:
When our build id reached 65535, Roslyn (.NET Compiler Platform) error-ed when building our projects:
AssemblyInfo.cs: Error CS7034: The specified version string does not conform to the required format - major[.minor[.build[.revision]]]
It turns out that the compiler uses the data type โunsigned __int16โ (i.e. unsigned 2-byte int) which has a range from 0 to 65,535.
As a workaround, I modified the script above to remove the first digit from the build id $env:Build_BuildID.Substring(1)
. VSTS support said it would not be possible to reset the build idโsโฆ
Has anybody out there come up with a better solution?