Xamarin解决方案仅使用MSBuildPlatform.x86构建

时间:2017-07-17 17:26:28

标签: xamarin msbuild cakebuild

我有以下问题:

我正在使用CakeBuild在Windows计算机(Windows 10)上构建我的Xamarin.Forms解决方案。

当我使用以下命令时,一切都很好:

MSBuild("MyXamarinApp.sln", configurator =>
        configurator.SetConfiguration("Debug")
          .SetMSBuildPlatform(MSBuildPlatform.x86));

但是,如果我删除“SetMSBuildPlatform(MSBuildPlatform.x86)”,它在内部使用“MSBuildPlatform.x64”,然后我收到以下错误:

(_GetReferenceAssemblyPaths target) ->
  C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(566,2): error MSB3644: The reference assemblies for framework "MonoAndroid,Version=v1.0" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.

有人可以解释这种行为吗?我是否只能使用x86版本的MSBuild来构建Xamarin项目?

1 个答案:

答案 0 :(得分:0)

您需要在Android应用程序目标中设置该平台。 (AndroidProject - >选项)。

x86即桌面架构。您可以使用它在模拟器上构建和测试,但对于真实设备,您需要选择至少一个移动架构(任何不是x86或x86_64的架构)

enter image description here