如何在 TFS 构建定义中获取签入注释/消息?

如何在 TFS 构建定义中获取签入注释/消息?

问题描述:

是否可以在 TFS 2013 构建定义(工作流文件)中获取签入注释/消息?我查看了 BuildDetail 但没有找到.

Is it possible to get the checkin comment/message in a TFS 2013 build definition (work flow file)? I have looked in BuildDetail but haven't found it.

Comment 是 变更集.您可以通过查询变更集来访问评论.下面的代码段在默认模板的 AssociateChangesetsAndWorkItems 活动之后添加时,循环遍历所有变更集 (associateChangesets) 并打印每个变更集 (cs) 注释.

Comment is a property a of a Changeset. You can access the comment by querying the changesets. The snippet below when added after the AssociateChangesetsAndWorkItems activity of the default template, loops through all changesets (associatedChangesets) and prints each changeset (cs) comment.

<ForEach x:TypeArguments="mtvc:Changeset" DisplayName="ForEach&lt;Changeset&gt;" Values="[associatedChangesets]">
  <ActivityAction x:TypeArguments="mtvc:Changeset">
    <ActivityAction.Argument>
      <DelegateInArgument x:TypeArguments="mtvc:Changeset" Name="cs" />
    </ActivityAction.Argument>
    <mtbwa:WriteBuildMessage Message="[String.Format(&quot;Changeset {0}: {1}&quot;, cs.ChangesetId, cs.Comment)]" />
  </ActivityAction>
</ForEach>