I have reviewed a few methods for changing from the default build numbering scheme that TFS uses (BuildDefintionName.Date.DailyIncrement). Often teams prefer something closer to Major.Minor.PointRelease.Build (e.g. 2.4.1.344). There is a great post that talks about accomplishing this here http://www.woodwardweb.com/vsts/000417.html
The Major, Minor, and PointRelease portions are manually changed but the Build portion is auto generated during the build process. To accomplish this, techniques highlighted in the linked post above (also in the posts comments) rely on creating custom MS Build tasks, accessing a database, and/or checking in special purpose buildversion files into source control. Some of us don't want the complexity and the more involved setup someone else in the future is going to have to understand to support the build number scheme.
With the goal of simplicity and a more descriptive build number, I have listed the MS Build script below that will make your build number (and automated label) look like BuildDefinitionName.Major.Minor.PointRelease.Build where Build equals a detailed date string (YearMonthDayHourMinuteSecondMillisecond) that includes milliseconds (e.g. MyTeamBuildSciptName.2.4.1.200812040930501111).
Yes the Build Number is longer which many will not like but it's a very descriptive number and is really easy to setup and understand. I include milliseconds to virtually eliminate the possibility that people will build the same script at the same time thereby causing a name collision.
How it's done:
2. Add an import statement in your build script
<Import Project="$(MSBuildExtensionsPath)\SDCTasks\Microsoft.Sdc.Common.tasks" />
3. Add the Major Minor and Point Release properties
...
<PropertyGroup>
<!-- TEAM PROJECT
This property is included only for backwards compatibility. The team project for a build
definition is now stored in the database. For compatibility with V1 clients, keep this property in
sync with the value in the database.
-->
<TeamProject>IGSProject</TeamProject>
<VersionMajor>2</VersionMajor>
<VersionMinor>4</VersionMinor>
<VersionPointRelease>1</VersionPointRelease >
...
4. Add an override target to change the BuildNumber property. Here we are using the Time.GetTime tasks included with the SDCTasks.
...
<Target Name="BuildNumberOverrideTarget">
<Time.GetTime Format="yyMMddhhmmssffff">
<Output TaskParameter="Time" PropertyName="customtimestamp" />
</Time.GetTime>
<PropertyGroup> <BuildNumber>$(BuildDefinitionName)_V$(VersionMajor).$(VersionMinor).$(VersionPointRelease).$(customtimestamp)</BuildNumber>
</PropertyGroup>
...
Recent Comments