我试图在我的MVC 6(dnx 4.5)网络应用中实例化WorkItemStore类,但我收到以下DllNotFoundException错误。
类型' System.DllNotFoundException'的例外情况发生在Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader.dll但未在用户代码中处理
其他信息:无法加载DLL' Microsoft.WITDataStore32.dll':找不到指定的模块。 (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窗体应用程序。这是Dot Net Core的问题吗?我已经在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:\Users\eashan\Documents\Building a Web App using ASP 5\FinalApp1\src\FinalApp1\Models\Config.cs:line 23
TargetSite - {Void CreateDatastore(IntPtr ByRef)}
TypeName - ""
任何形式的帮助都将受到赞赏。
答案 0 :(得分:3)
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);
答案 1 :(得分:0)
现在,我已经设法让它工作。我比较了我的Windows应用程序表单和我的dnx执行环境的构建路径。
使用ILSpy检查了Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader.dll库后,我发现它确实引用了Microsoft.WITDataStore32.dll,即使它存在于dnx执行文件夹中
C:\用户\ eashan.dnx \包\ Microsoft.TeamFoundationServer.ExtendedClient \ 14.89.0 \ lib中\天然\ X86
中不存在
C:\用户\ eashan.dnx \包\ Microsoft.TeamFoundationServer.ExtendedClient \ 14.89.0 \ lib中\ net45 文件夹中。
因此,我将库从第一个位置复制到另一个位置并且它有效。