TFS 2010:以内部编号格式使用标签名称 [英] TFS 2010 : Use the label name in build number format

查看:80
本文介绍了TFS 2010:以内部编号格式使用标签名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用TFS 2010设置内部版本。我希望内部版本号格式类似于 $(BuildDefinitionName)_ $(version),其中 $(Version)是在队列生成对话框的获取版本字段中指定的版本(标签或变更集)。如果没有特定版本,我希望该版本为最新

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.

我为此进行了google搜索,但我不熟悉msbuild和TFS

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.

谢谢。

推荐答案

内部版本模板(例如DefaultTemplate.xaml)中的Microsoft.TeamFoundation.Build.Workflow.Activities.UpdateBuildNumber活动是转换内部版本号格式字符串的工作。它采用此处列出的任何参数,但是,版本(您的

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.

一种我不需要自定义代码的解决方法是在更新生成之前立即编辑BuildNumberFormat参数。

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. 使用GUI编辑器打开xaml模板,并在顶部找到更新内部版本号活动。
  2. >
  3. 在工具箱中找到基元->分配活动。将其拖放到更新内部版本号的上方。

  4. 编辑Assign活动以分配值 String.Format( $(BuildDefinitionName)_ $(Date: yyyyMMdd)_ {0} $(Rev:.r),BuildDetail.SourceGetVersion) BuildNumberFormat 。 SourceGetVersion将拉出用于触发构建的变更集编号或标签。如果在对构建进行排队时,在获取版本对话框中未指定任何内容,则默认使用变更集编号(例如C16044)。

  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).

这篇关于TFS 2010:以内部编号格式使用标签名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆