在C#asp.net中获取TFS中的所有项目列表?

时间:2018-02-14 08:03:34

标签: c# asp.net tfs

我正在制作一个asp.net网络表单,其中我需要所有TFS验证后的项目,我已经通过以下代码完成了

var collectionUri = new Uri("https://project.visualstudio.com/DefaultCollection");

var credential = new NetworkCredential("username", "password");
var teamProjectCollection = new TfsTeamProjectCollection(collectionUri, credential);
teamProjectCollection.EnsureAuthenticated();

1 个答案:

答案 0 :(得分:2)

您只需编写 Linq 查询,如下所示: -

WorkItemStore workItemStore = new WorkItemStore(teamProjectCollection);
var project = (from Project pr in workItemStore.Projects
               select pr);