我试图在我的MVC 6(dnx 4.5)Web应用程序中实例化WorkItemStore类,但出现以下DllNotFoundException错误.
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)
这是我的代码.
200Uri = new Uri("http://x contains tfs server link of company x");
200ProjectCollection = new TfsTeamProjectCollection(200Uri);
200WorkItemStore = new WorkItemStore(200ProjectCollection);
更令人惊奇的是,相同的类和代码在我以前的ASP 4.5 Windows Forms应用程序上也可以工作.这是Dot Net Core的问题吗?我已经在点网核心中切换到dnx 4.5.1吗?还是MVC 6?这是32-64位库的问题吗?
有关错误的更多详细信息-
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:UserseashanDocumentsBuilding a Web App using ASP 5FinalApp1srcFinalApp1ModelsConfig.cs:line 23
TargetSite - {Void CreateDatastore(IntPtr ByRef)}
TypeName - ""
任何帮助将不胜感激.
解决方法:
使用NuGet
>打开NuGet软件包管理器.
>转到浏览.
>安装Microsoft.TeamFoundationServer.ExtendedClient.
>安装Microsoft.WindowsAzure.ConfigurationManager.
这是生成的project.json文件(为清楚起见删除了部分).
{
"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": { }
}
}
安装这两个软件包后,将构建并运行以下代码.
var xUri = new Uri("http://www.somedomain.com");
var xProjectCollection = new TfsTeamProjectCollection(xUri);
var xWorkItemStore = new WorkItemStore(xProjectCollection);
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!