axe*_*axe 5 .net 64-bit x86 project anycpu
可能重复:
加载x86或x64程序集
我正在尝试编译任何CPU .NET项目,但我必须链接SQLite库,它具有x86和x64平台的不同版本.仅将DLL版本更改为x64没有帮助,应用程序无法启动,我需要使用x64引用重新编译代码.当我添加x86和x64引用时,由于冲突,它无法编译.我无法使用x86编译应用程序,因为我正在使用的系统COM库之一在WOW64下无法运行.
All 32-bit VSS applications (requesters, providers, and writers) must run as native 32-bit or 64-bit applications. Running them under WOW64 is not supported
所以我需要构建任何CPU项目,但我目前看到的唯一解决此问题的方法是为x86和x64重复项目.有更好的吗?
UPDATE
当我在项目中引用x64库,但尝试加载x86库时,我得到以下异常.
The located assembly's manifest definition does not match the assembly reference.
主要问题是我使用不同版本的SQLite for x86和x64.我添加了方法
static private Assembly SQLitePlatformSpecificResolve(object sender, ResolveEventArgs args)
{
string platform = Environment.Is64BitProcess ? "x64" : "x86";
string assemblyName = new AssemblyName(args.Name).Name;
string assemblyPath = Path.Combine(
Environment.CurrentDirectory, "SQLite", platform, assemblyName + ".dll");
return !File.Exists(assemblyPath) ? null : Assembly.LoadFrom(assemblyPath);
}
Run Code Online (Sandbox Code Playgroud)
并设置事件处理程序
AppDomain.CurrentDomain.AssemblyResolve += SQLitePlatformSpecificResolve;
Run Code Online (Sandbox Code Playgroud)
在主要应用程序入口点.现在它相应地为x86平台和64位平台上的x64加载x86程序集.
谢谢.
| 归档时间: |
|
| 查看次数: |
1449 次 |
| 最近记录: |