处理器架构不匹配构建错误

Processor architecture mismatch building error

在尝试 运行 测试应用程序时,我两次收到以下错误:

There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll", "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. TestMobile.Core mismatch MSIL x86

我安装了 .NET Framework,以及 windows 8 个 SDK 工具并使用 MultilingualAppToolKit。

我已经验证了配置管理器,一切似乎都很好。平台目标,定位 "Any CPU"

我终于能够在没有这个肮脏错误的情况下构建我的项目。看来我需要从 VS2010 安装 Portable Library Tools。之后就成功了。

参考:http://forums.xamarin.com/discussion/25538/xamarin-xaml-example-problem-using-pcl

安装 Visual Studio 2015 更新 2 后出现此问题。试试这个,第一个解决了我的问题:

安装便携式 Class 库 v4.6

  1. 下载安装Portable Class Libraries v4.6。如果你安装它,它会将一个 .zip 文件放入目录中: "C:\Program Files (x86)\Microsoft .NET Portable Library Reference Assemblies 4.6"
  2. 解压并将内容复制到"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\"

安装 PCL 工具

  1. 下载Portable Class Library Tools
  2. 通过 运行 PortableLibraryTools.exe /buildmachine
  3. 安装

资料来源:马特·沃德@https://forums.xamarin.com/discussion/comment/80535/#Comment_80535

复制我现有版本的 .NET 可移植库参考程序集解决了我的问题。

我在安装 Visual Studio 2015 Update 3 的补丁后遇到了这个问题,阅读了 vvolkgang 的回复并开始打折,因为我已经在 C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable 中有文件夹,并且这些文件夹的日期较晚比我下载的参考程序集档案中包含的那些。我应该做的是检查 文件夹层次结构的正确部分 。查看您的项目文件;在我的例子中,我有这些设置:

<TargetFrameworkProfile>Profile49</TargetFrameworkProfile>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>

如果这些是您的设置,您需要检查 C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile\Profile49 的内容。如果您使用不同的配置文件或针对不同版本的框架,请相应地调整路径。当我检查那个文件夹时,我发现我有很多 XML 文件但没有 DLL;从 Microsoft .NET Portable Library Reference Assemblies 4.6 复制文件并选择不替换任何已存在的文件修复了我的构建问题。

如果您在构建服务器上并获得此 Error/Warning,只需安装 MSBuild 17 及其包含所有 SDK 和便携式库的可选安装。