How TFS Build Get Associated Changesets/Workitems and Update Workitems

本文详细介绍了TFS构建过程中如何获取关联的变化集、工作项,以及如何更新工作项的状态。阐述了通过变化集属性获取相关联的工作项,并展示了在TFS中如何手动将工作项与变化集关联的方法。

When we queue a build in TFS, if it failed, TFSBuild will create a bug workitem. If it successes, TFSBuild will update associated  workitems.

1 How TFSBuild gets  associated changesets

private void AnalyzeChangesets(Item[] lastItems, Item[] currentItems);

Declaring Type:
Microsoft.TeamFoundation.Build.Tasks.GenCheckinNotesUpdateWorkItems

Assembly:
Microsoft.TeamFoundation.Build.Tasks.VersionControl, Version=9.0.0.0

 

 
The task GenCheckinNotesUpdateWorkItems will get lastItems[] in  LastGoodBuildLabel  and currentItems[] in CurrentLabel.
A If lastItems[i]’s ItemID matches a item in currentItems, like currentItems[j]

Get all changesets between lastItems[i]’s changesetID and currentItems[j]’s changesetID that include this item.

Notice, not all changeset between them include this item

B If lastItems[i]’s ItemID does not match any item in currentItems and does not exist in Latest version

This means that the Item may be deleted in a changeset.Get all changesets between lastItems[i]’s changesetID and VersionSpec.Latest that include this item.

 

C If currentItems[i]’s ItemID does not match any item in lastItems

Get all changesets between ChangesetVersionSpec(1) and currentItems[i]’s changesetID that include this item.

 

2 How TFSBuild get associated WorkItems

Each changesets contains a prroperty WorkItems. In the step1 we can get all associated changesets, and then we can get all WorkItems.

3 How associate a WorkItem to changeset

A In Team Explorer, when you check-in a changeset, you can associate workitems to it.

B in Team Explorer, you can edit a changeset and associate workitems to it.

 

4 How TFSBuild Update WorkItems

TFSBuild will set item["Microsoft.VSTS.Build.IntegrationBuild"] = this.BuildNumber for all associated workitem which have this field.

转载于:https://www.cnblogs.com/Ruiz/archive/2010/07/29/1787475.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值