EricD
EricD

Reputation: 551

Build ionic2 app for Windows10 fail when adding MobileFirst plugin

The problem:

What i try:

My setup:

The complete procedure:

Start a clean project :

ionic start testBuildWin10 -v2
cd testBuildWin10 

setup config.xml to target windows10 instead of windows 8.1

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

At this step, the app works, but failed when adding mfp :

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

an error ask me to add the argument --archs=x64

Running command: "C:\Program Files\nodejs\node.exe" C:\Users\Eric\Desktop\testBuildWin10-2\hooks\after_prepare\010_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\14.0\bin\msbuild.exe: Command failed with exit code 1

then when i run ionic run --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\14.0\bin\msbuild.exe: Command failed with exit code 1

Upvotes: 3

Views: 743

Answers (1)

Vittal Pai
Vittal Pai

Reputation: 3583

Mobilefirst Windows SDK packages with architecture specific DLL's. Hence ionic run windows command will fail as it runs for AnyCPU.

In order to run platform specific commands you need to add -- separator before --archs=x64.

Try with command ionic run windows -- --archs=x64, I hope it should resolve the issue.

Upvotes: 3

Related Questions