我在 Visual Studio 2012 中有一个 C# 项目,它是一个 PCL,针对这些平台(我删除了名称):
当我尝试将 dll 从成功构建添加到 VS2013 中的 Silverlight 5 项目时,我收到此警告并且它似乎并没有真正被添加:
Warning 1 There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "[Name]", "x86". 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.
为什么 PCL 会显示为 x86?
最佳答案
当您有一个用于多个目标的 PCL 项目并且您想要在其他项目中引用输出 .dll 时,请确保您选择了具有正确编译的正确 .dll。
例如:
- 您有一个商业项目,它是适用于 WP 8 和 SL 5 的 PCL。
- 您有 2 个项目引用上述业务项目的 dll
- SL项目
- WP 8 项目
在 WindowsPhone 项目中,当你去添加引用时,你应该选择为 ARM 编译的那个 [注意,如果你想在模拟器上运行,你应该选择 x86 版本,因为模拟器不是 ARM]。如果您添加 x86 版本并在配置管理器中将其设置为 ARM,Visual Studio 将警告您出现相同的错误,因为您将运行 ARM 代码并引用 x86 代码。
检查您添加的.dll 是否与配置管理器匹配。将其更改为您想要的正确架构,而不是“多平台”与“任何 CPU”
关于c# - 为什么来自 PCL 项目的 DLL 是 x86 程序集?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26244174/