3
votes

The problem:

  • I have an app in ionic2 that I could build for windows 10, until I added cordova-plugin-mbf (MBF version 8.0.0).
  • When I added it, the build failed and asked me to add the argument --archs=x64
  • With it, the build continue to fail but with this error "msbuild.exe: Command failed with exit code 1"

What i try:

  • start a new project to validate that I can build without the plugin
  • add the plugin to an empty project to validate that it's it who throw the error
  • reinstall windows from scratch to be sure that my setup is correct
  • build with node v5.12
  • cry a lot

My setup:

  • Cordova CLI: 6.3.1
  • Ionic Framework Version: 2.0.0-beta.11
  • Ionic CLI Version: 2.0.0-beta.37
  • Ionic App Lib Version: 2.0.0-beta.20
  • OS: Node Version: v6.5.0

  • Windows 10 version 1511; 10586.545

  • Visual Studio 2015 comunity edition with :
    • microsoft web development tools
    • universal windows app development tools
      • tools (1.4.1) and windows 10 SDK (10.0.14393)
      • windows 10 SDK (10.0.10586)
      • windows 10 SDK (10.0.10240)
    • windows 8.1 and windows phone 8.0/8.1 Tools
      • Tools and Windows SDK
    • emulator for Windows Phone 8.1

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

1

1 Answers

3
votes

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.