Reputation: 2180
I'm trying to setup a build with TFS 2010. I want the build number format to be something like $(BuildDefinitionName)_$(version) where $(Version) is the version (label or changeset) specified in the "Get Version" field in the "Queue Build" dialog. If there's no specific version, I would like the version to be latest.
I googled for that but I'm new to msbuild and TFS build so I'm not sure what I should look for to get started.
Thanks.
Upvotes: 3
Views: 6511
Reputation: 604
The Microsoft.TeamFoundation.Build.Workflow.Activities.UpdateBuildNumber activity in your build template (e.g. DefaultTemplate.xaml) is what does the work of transforming your build number format string. It takes any of the parameters listed here, however, the version (your changeset or label) is not one of the supported tags.
One workaround I've found that does not require custom code is to edit the BuildNumberFormat argument immediately before the Update Build Number activity uses it.
String.Format("$(BuildDefinitionName)_$(Date:yyyyMMdd)_{0}$(Rev:.r)", BuildDetail.SourceGetVersion)
to BuildNumberFormat
. The SourceGetVersion will pull the changeset number or label used to trigger the build. If nothing is specified in the Get Version dialog when you're queuing your build then the changeset number is used by default (e.g. C16044).Upvotes: 5
Reputation: 339
this is a good start http://www.ewaldhofman.nl/post/2010/06/01/Customize-Team-Build-2010-e28093-Part-10-Include-Version-Number-in-the-Build-Number.aspx
Upvotes: 1