开发者

TFS 2010 : Use the label name in build number format

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.


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.

  1. Open up the xaml template using the GUI editor and find the Update Build Number activity at the top.
  2. Find the Primitives -> Assign activity in the Toolbox. Drag and drop that just above the Update Build Number.
  3. Edit the Assign activity to assign the value 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).


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜