Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DllNotFoundException in ASP5/MVC6 while instantiating an object (using the WorkItemStore Class)

I'm trying to instantiate the WorkItemStore Class in my MVC 6 (dnx 4.5) web app but I'm getting the following DllNotFoundException error.

An exception of type 'System.DllNotFoundException' occurred in Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader.dll but was not handled in user code

Additional information: Unable to load DLL 'Microsoft.WITDataStore32.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

This is my code.

        200Uri = new Uri("http://x contains tfs server link of company x");
        200ProjectCollection = new TfsTeamProjectCollection(200Uri);
        200WorkItemStore = new WorkItemStore(200ProjectCollection);

The more amazing thing is that the same class and code works on my previous ASP 4.5 Windows Forms app. Is this a problem with Dot Net Core? I've already switched to dnx 4.5.1 in dot net core? or MVC 6? Is this a problem with 32-64 bits library?

More details about the error-

System.DllNotFoundException - {"Unable to load DLL 'Microsoft.WITDataStore32.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"}
Data - {System.Collections.ListDictionaryInternal}
HelpLink - Null
InnerException - null
Message - Unable to load DLL 'Microsoft.WITDataStore32.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Source: Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader
StackTrace -    at Microsoft.TeamFoundation.WorkItemTracking.Client.DataStore.DataStoreNative32.CreateDatastore(IntPtr& handle)
   at Microsoft.TeamFoundation.WorkItemTracking.Client.DataStore.DataStoreNative.CreateDatastore(IntPtr& handle)
   at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore.InitializeInternal()
   at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore.Microsoft.TeamFoundation.Client.ITfsTeamProjectCollectionObject.Initialize(TfsTeamProjectCollection teamProjectCollection)
   at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore..ctor(TfsTeamProjectCollection teamProjectCollection, WorkItemStoreFlags workItemStoreFlags)
   at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore..ctor(TfsTeamProjectCollection teamProjectCollection)
   at FinalApp1.Models.Config..ctor() in C:\Users\eashan\Documents\Building a Web App using ASP 5\FinalApp1\src\FinalApp1\Models\Config.cs:line 23

TargetSite - {Void CreateDatastore(IntPtr ByRef)}
TypeName - ""

Any kind of help will be appreciated.

like image 287
eashan Avatar asked Nov 30 '25 16:11

eashan


1 Answers

Use NuGet

  1. Open the NuGet Package Manager.
  2. Go to Browse.
  3. Install Microsoft.TeamFoundationServer.ExtendedClient.
  4. Install Microsoft.WindowsAzure.ConfigurationManager.

Microsoft.TeamFoundationServer.ExtendedClient

Here is the resultant project.json file (with sections deleted for clarity.)

{ 
  "dependencies": {
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.TeamFoundationServer.ExtendedClient": "14.89.0",
    "Microsoft.WindowsAzure.ConfigurationManager": "3.2.1"
  }

  "frameworks": {
    "dnx451": { }
  }
}

After installing those two packages, the following code builds and runs.

var xUri = new Uri("http://www.somedomain.com");
var xProjectCollection = new TfsTeamProjectCollection(xUri);
var xWorkItemStore = new WorkItemStore(xProjectCollection);
like image 125
Shaun Luttin Avatar answered Dec 02 '25 06:12

Shaun Luttin