2016-03-02 47 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。 –