添加 MobileFirst 插件时,为 Windows10 构建 ionic2 应用程序失败

Build ionic2 app for Windows10 fail when adding MobileFirst plugin

问题:

我的尝试:

我的设置:

完整程序:

开始一个干净的项目:

ionic start testBuildWin10 -v2
cd testBuildWin10 

设置 config.xml 目标 windows10 而不是 windows 8.1

<platform name="windows">
    <preference name="windows-target-version" value="10.0" />
</platform>

在这一步,应用程序可以运行,但在添加 mfp 时失败:

cordova plugin add cordova-plugin-mfp
cordova prepare
ionic run windows

一个错误要求我添加参数 --archs=x64

Running command: "C:\Program Files\nodejs\node.exe" C:\Users\Eric\Desktop\testBuildWin10-2\hooks\after_prepare0_add_platform_class.js C:\Users\Eric\Desktop\testBuildWin10-2

add to body class: platform-windows

Building project: C:\Users\Eric\Desktop\testBuildWin10-2\platforms\windows\CordovaApp.Windows10.jsproj

    Configuration : debug
    Platform      : anycpu

C:\Users\Eric\Desktop\testBuildWin10-2\platforms\windows\CordovaApp.Windows10.jsproj(83,9): error : The following component requires .NET Native compilation which is not available when targeting 'Windows10' and 'AnyCPU'. Consider changing the targeted processor architecture to one of the following: 'x86, x64, ARM' (if you are using command line this could be done by adding '--archs' parameter, for example: 'cordova build windows --archs=x64'). C:\Users\Eric\Desktop\testBuildWin10-2\platforms\windows\plugins\cordova-plugin-globalization\GlobalizationProxy.winmd

Error: C:\Program Files (x86)\MSBuild.0\bin\msbuild.exe: Command failed with exit code 1

然后当我 运行 ionic 运行 --archs=x64

C:\Users\Eric\Desktop\testBuildWin10-2\platforms\windows\CordovaApp.Windows10.jsproj(83,9): error : The following component requires .NET Native compilation which is not available when targeting 'Windows10' and 'AnyCPU'. Please consider changing the targeted processor architecture to one of the following: 'x86, x64, ARM' (if you are using command line this could be done by adding '--archs' parameter, for example: 'cordova build windows --archs=x64'). C:\Users\Eric\Desktop\testBuildWin10-2\platforms\windows\plugins\cordova-plugin-globalization\GlobalizationProxy.winmd

Error: C:\Program Files (x86)\MSBuild.0\bin\msbuild.exe: Command failed with exit code 1

Mobilefirst Windows SDK 包具有特定于体系结构的 DLL。因此 ionic run windows 命令将失败,因为它 运行s for AnyCPU

为了 运行 平台特定命令,您需要在 --archs=x64 之前添加 -- 分隔符。

尝试使用命令 ionic run windows -- --archs=x64,希望它能解决问题。