gpt4 book ai didi

tfs - 在 TFS 中查找 IterationID

转载 作者:行者123 更新时间:2023-12-04 15:49:24 26 4
gpt4 key购买 nike

我们正在将 TFS 内的迭代链接到一个外部系统,以跟踪整个公司的项目。过去,我们在 TFS 项目中使用 IterationPath 进行链接,但问题是人们随着项目的进展重命名这些 IterationPath,链接丢失。因此,经过一些研究,我正在考虑使用 IterationID 进行链接。 TFSWarehouse 中的 IterationID 与 WorkItemTracking 表中的 IterationID 不一样,我似乎找不到找到 IterationPath 的 IterationID 的简单方法?任何人都知道我们如何能够实现这一目标?

最佳答案

好的 - 经过一些进一步的挖掘,发现下面的代码遍历所有迭代,所以使用它的一个子集,我会得到我需要的:)

using System;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.WorkItemTracking.Client;

namespace TFSIterationList
{
class Program
{
static void Main(string[] args)
{
string tfsServer = "tfs";
string tfsProject = "Project Name";
TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer(tfsServer);
WorkItemStore store = new WorkItemStore(tfsServer);
PrintTreeNodeCount(store, tfsProject);
}


private static void PrintTreeNodeCount(WorkItemStore store, string tfsProject)
{
int iterationNodeCount = 0;
NodeCollection rootNodeCollection = store.Projects[tfsProject].IterationRootNodes;
GetChildNodeCount(rootNodeCollection, ref iterationNodeCount);
Console.WriteLine(tfsProject + " Iteration nodes : " + iterationNodeCount);
}

private static void GetChildNodeCount(NodeCollection nodeCollection, ref int nodeCount)
{
nodeCount += nodeCollection.Count;
for (int i = 0; i < nodeCollection.Count; i++)
{

Console.WriteLine(nodeCollection[i].Id + " : " + nodeCollection[i].Path);
// Console.WriteLine(nodeCollection[i].Name);

if (nodeCollection[i].ChildNodes.Count > 0)
{
// Recursively walk through the child nodes
GetChildNodeCount(nodeCollection[i].ChildNodes, ref nodeCount);
}
}
}

}
}

关于tfs - 在 TFS 中查找 IterationID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1156649/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com