2016-03-02 69 views
1

我想從TFS中查詢一些工作項,但GetService時,出現異常。有人能幫我嗎。構建Workitem商店時出現異常

ICredentials networkCredential = new NetworkCredential("XXX", "XX", "XXX"); 
Uri tfsUri = new Uri(@"http://tfs:8080/tfs/DefaultCollection"); 
TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(tfsUri, networkCredential); 
tfs.EnsureAuthenticated(); 
WorkItemStore Store = (WorkItemStore)tfs.GetService(typeof(WorkItemStore)); 

錯誤

類型的未處理的異常 'System.IO.FileNotFoundException' 發生在Microsoft.TeamFoundation.WorkItemTracking.Client.dll

其他信息:無法加載文件或程序集 'Microsoft.TeamFoundation.WorkItemTracking.Proxy,Version = 11.0.0.0, Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'或其中一個 依賴關係。該系統找不到指定的文件。

enter image description here

回答

1

的錯誤似乎很清楚:你錯過Microsoft.TeamFoundation.WorkItemTracking.Proxy。安裝TFS 2012對象模型,並將對該程序集的引用添加到項目中。我說2012,因爲版本11.x表示2012年TFS。12將2013年,14將2015年。

+0

您可能更好地使用Nuget上可用的TFS對象模型,因爲它不需要安裝TE。 –