我有一个 Visual Studio 2012 .Net 主项目,其构建属性中指定了平台目标 x86。该项目由多个C++项目和C#项目组成。在我的配置管理器中,C# 项目的平台是 Any CPU,C++ 项目的平台是 Win32。我想引用一个针对 AMD64 的第三方 dll。添加引用时,我收到以下警告:
Warning: Warning: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "DALSA, processorArchitecture=AMD64", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
如果我尝试为平台目标 x64 更改主 C# 项目构建,它会提示,因为它依赖的外部 DLL 具有平台目标 x86。
任何我在做什么wr0ng?
最佳答案
所以你有两只左脚鞋,没有一只右脚鞋。如果你想走路,你应该以某种方式得到一双合适的鞋子。获取 x86 DALSA 或 Win64 外部 DLL。
单个进程不可能运行在不同的架构上。
唯一的其他选择是创建一个辅助进程,主进程将连接到一些 IPC就像管道一样,它将运行在互补的架构上。或者用 COM 对象包装 DLL。
关于c# - 正在构建的项目 "MSIL"的处理器架构与引用“AMD64”的处理器架构不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27516412/