0

I am trying to access WorkItemStore object to connect to TFS from my VS code:

public WorkItemStore WorkItemStore { get { return workItemStore ?? (workItemStore = new WorkItemStore(Connection, WorkItemStoreFlags.BypassRules)); } }

and getting the below error:

System.IO.FileNotFoundException HResult=0x80070002 Message=Could not load file or assembly 'Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

My Configuration:

  • Windows 10 Enterprise

  • Visual Studio Professional 2017

  • NuGet Package Manager for Visual Studio 2017

I have tried below steps as mentioned in the post Failed reference for WITDataStore.dll :

  1. manually download the package, unzip it, and copy the unzipped folder into my solution's packages\ directory.

  2. Add a reference in my project to the copy of Microsoft.TeamFoundation.WorkItemTrackingClient.DataStoreLoader.dll in the unzipped package.

  3. Add the file WITDataStore.dll as an Existing File to my project, and mark it as "Copy Always" under "Properties". ("Copy if newer" will also work just fine) Add the line to the packages.config file for my project.

Kindly help/suggest to overcome the FileNotFoundException

Thanks in advance!

Hema
  • 1
  • What are you trying to acheive? I have a lot of example code that interacts with WorkItems but I don't use anything called WorkItemStore. I use [this](https://learn.microsoft.com/en-us/dotnet/api/microsoft.teamfoundation.workitemtracking.webapi.workitemtrackinghttpclient?view=azure-devops-dotnet) – Crowcoder Jun 22 '20 at 16:49
  • I am using WorkItemStroe to execute the query. Please find the reference for more details [https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2013/bb179850(v=vs.120)]. – Hema Jun 23 '20 at 05:23
  • You haven't shown a query. I might be able to help you use a different method if you are interested. I have examples of getting/creating/upating work items and runing wiql queries. – Crowcoder Jun 23 '20 at 11:55

1 Answers1

0

FileNorFoundException - Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader

According to the error message:

Could not load file or assembly 'Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.

You are missing the reference Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader with version 15.0.0.0. But the version of the package nuget-bot.Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader you tried is 12.0.31101. That the reason why it not work for you.

According to the document Microsoft.TeamFoundation.WorkItemTracking.Client Namespace, we could to know:

You can find the Microsoft.TeamFoundation.WorkItemTracking.Client namespace in \Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0 on computers where Team Explorer is installed, in the following assembly:

  • Microsoft.TeamFoundation.WorkItemTracking.Client.dll

Since you are using the Visual Studio 2017, the reference Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader.dll could be found under the path:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer

enter image description here

Hope this helps.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135
  • Thanks for the response Leo. As I have dependency in my package.config file of Unit Test project; Hence, as part of one of the resolution steps (to get rid of 'Unable to load WITDataStore.dll' error), I have added 12.0,0,0 version of Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader dll. Kindly suggest, how to proceed with that WorkItemStore will not throw the dll errors. Thank you! – Hema Jun 23 '20 at 10:49
  • @Hema, As I answered in my above answer, you need to uninstall that nuget package, then reference the dll file directly from the path `C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer`. Or you could copy this dll file to your project, then reference it. BTW, need submit this dll file to the source control. – Leo Liu Jun 24 '20 at 08:32