tfs - 在 TFS 中查找 IterationID

标签 tfs iteration

我们正在将 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/

相关文章:

c# - 获取解决方案本地子文件夹的 TFS 映射文件夹?

将修改后的文件与最新版本进行比较的 TFS 快捷方式

algorithm - 如何迭代 k 叉树?

javascript - .join() 函数在 map 函数中无法正常工作

每次递归都可以改成迭代吗?

TFS命令行获取特定工作空间的所有映射信息

excel - 使用 Excel 在 TFS 中创建链接任务

sharepoint - 从 Team Foundation Build 调用的 Powershell 脚本远程执行

Java——迭代不起作用

python - 如何组合多个字典,在 Python 中对公共(public)键的值求和(并保留值为 0 的值)?