我正在尝试编译任何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
http://social.msdn.microsoft.com/Forums/en-US/windowsgeneraldevelopmentissues/thread/eadf5dcd-fbd1-4224-9a56-b5843efebb15/
因此,我需要构建任何CPU项目,但我目前看到的解决这个问题的唯一解决方案是为x86和x64创建重复的项目。还有什么更好的吗?
更新
当我在项目中引用x64库,但尝试加载x86库时,我会得到以下异常。
The located assembly's manifest definition does not match the assembly reference.
发布于 2012-07-24 13:15:58
主要的问题是,我为x86和x64使用了不同版本的x86。我加了方法
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);
}并设置事件处理程序。
AppDomain.CurrentDomain.AssemblyResolve += SQLitePlatformSpecificResolve;在主应用程序入口点。现在,它为x86平台加载x86程序集,在64位平台上加载x64。
谢谢。
https://stackoverflow.com/questions/11629807
复制相似问题