0
在這裏workItemStore總是返回空.....我想要日誌問題tp TFS作爲nugs。但不能becoz空exception..help的,這樣做是grealy讚賞...謝謝....TFS WorkItems始終返回空值
var networkCredential = new NetworkCredential(userName, password, domainName);
var credential = (ICredentials)networkCredential;
//Connect to TFS Project Collection, provide server URL in format http:// ServerName:Port/Collection
var tfs = new TfsTeamProjectCollection(
TfsTeamProjectCollection.GetFullyQualifiedUriForName(TfsConnectionUri), credential);
//Check whether valid TFS user or not
tfs.EnsureAuthenticated();
var workItemStore = (WorkItemStore)tfs.GetService(typeof(WorkItemStore));
//Iterate Through Projects
foreach (Project tfs_project in workItemStore .Projects)
{
Console.WriteLine(tfs_project.Name);
//Perform WIQL Query
WorkItemCollection wic = wis.Query(
" SELECT [System.Id], [System.WorkItemType],"+
" [System.State], [System.AssignedTo], [System.Title] "+
" FROM WorkItems " +
" WHERE [System.TeamProject] = '" + tfs_project.Name +
"' ORDER BY [System.WorkItemType], [System.Id]");
foreach (WorkItem wi in wic)
{
Console.WriteLine(wi.Title + "["+wi.Type.Name+"]"+wi.Description);
}
}
嗨,我試着上面的代碼它說..「無法加載程序集Microsoft.Teamfoundation.client.dll」..我使用的DLL版本11 ... – user2155788 2013-03-26 04:55:00
是啊!這是獲取WorkItemStore的方法!讓我從頭痛中解脫出來。非常感謝! +1 – misha 2014-01-08 13:27:12
謝謝。這種方式而不是返回null,我們得到一個Exception來知道要修復什麼。非常感謝你 – 2015-08-08 04:41:50