作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我们正在将 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/
我们正在将 TFS 内的迭代链接到一个外部系统,以跟踪整个公司的项目。过去,我们在 TFS 项目中使用 IterationPath 进行链接,但问题是人们随着项目的进展重命名这些 IterationP
我是一名优秀的程序员,十分优秀!