I am trying to query some workitems from TFS, but while GetService, I am getting exception. Can someone help me.
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));
Error:
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Microsoft.TeamFoundation.WorkItemTracking.Client.dll
Additional information: Could not load file or assembly 'Microsoft.TeamFoundation.WorkItemTracking.Proxy, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
The error seems pretty clear: You're missing Microsoft.TeamFoundation.WorkItemTracking.Proxy
. Install the TFS 2012 object model and add a reference to that assembly to your project. I say 2012 because version 11.x
indicates TFS 2012. 12 would be 2013, and 14 would be 2015.