添加 MobileFirst 插件时,为 Windows10 构建 ionic2 应用程序失败
Build ionic2 app for Windows10 fail when adding MobileFirst plugin
问题:
- 我在 ionic2 中有一个可以为 windows 10 构建的应用程序,直到我添加了 cordova-plugin-mbf(MBF 版本 8.0.0)。
- 添加的时候构建失败,让我添加参数--archs=x64
- 使用它,构建继续失败,但出现此错误 "msbuild.exe: Command failed with exit code 1"
我的尝试:
- 启动一个新项目以验证我是否可以在没有插件的情况下构建
- 将插件添加到一个空项目以验证是否是抛出错误的人
- 从头开始重新安装 windows 以确保我的设置正确
- 使用节点 v5.12 构建
- 经常哭
我的设置:
- Cordova CLI:6.3.1
- 离子框架版本:2.0.0-beta.11
- Ionic CLI 版本:2.0.0-beta.37
- Ionic 应用程序库版本:2.0.0-beta.20
OS:节点版本:v6.5.0
Windows10版本1511; 10586.545
- Visual Studio 2015 社区版:
- 微软网络开发工具
- 通用 windows 应用程序开发工具
- 工具 (1.4.1) 和 windows 10 SDK (10.0.14393)
- windows 10 个 SDK (10.0.10586)
- windows 10 个 SDK (10.0.10240)
- windows 8.1 和 windows phone 8.0/8.1 工具
- 工具和Windows SDK
- 模拟器 Windows Phone 8.1
完整程序:
开始一个干净的项目:
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
,希望它能解决问题。
问题:
- 我在 ionic2 中有一个可以为 windows 10 构建的应用程序,直到我添加了 cordova-plugin-mbf(MBF 版本 8.0.0)。
- 添加的时候构建失败,让我添加参数--archs=x64
- 使用它,构建继续失败,但出现此错误 "msbuild.exe: Command failed with exit code 1"
我的尝试:
- 启动一个新项目以验证我是否可以在没有插件的情况下构建
- 将插件添加到一个空项目以验证是否是抛出错误的人
- 从头开始重新安装 windows 以确保我的设置正确
- 使用节点 v5.12 构建
- 经常哭
我的设置:
- Cordova CLI:6.3.1
- 离子框架版本:2.0.0-beta.11
- Ionic CLI 版本:2.0.0-beta.37
- Ionic 应用程序库版本:2.0.0-beta.20
OS:节点版本:v6.5.0
Windows10版本1511; 10586.545
- Visual Studio 2015 社区版:
- 微软网络开发工具
- 通用 windows 应用程序开发工具
- 工具 (1.4.1) 和 windows 10 SDK (10.0.14393)
- windows 10 个 SDK (10.0.10586)
- windows 10 个 SDK (10.0.10240)
- windows 8.1 和 windows phone 8.0/8.1 工具
- 工具和Windows SDK
- 模拟器 Windows Phone 8.1
完整程序:
开始一个干净的项目:
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
,希望它能解决问题。