Build a Windows 10 App with Ionic 2 RC

I am trying to create an application that will work for iOS, Android and Windows. I posted a question in one of the other threads but it seems that I am unable to build my an Ionic 2 RC application for Windows 10 even from the command line.

To begin with, I would like to use Visual Studio to build and deploy the app for Windows. this will allow me to do debugging from within VS (will build iOS and Android differently). I run the build script within VS and it appears to work however when I go to run the app to debug or deploy from VS I get several errors. I believe the errors arrive from the following one:

Error TS1204 Cannot compile modules into ‘es2015’ when targeting ‘ES5’ or lower. TypeScript Virtual Projects 1 Active
After that I have several TS2307 errors (Cannot find Module). There are also a lot of TS2339 errors (Property … does not exist)

Now I try to run the application from the command line using: ionic run windows I get:

Exception calling “ActivateApplication” with “4” argument(s): “The remote procedure call failed. (Exception from
HRESULT: 0x800706BE)”
At C:\Users\jhoffman\Documents\ionictest\test12\platforms\windows\cordova\lib\WindowsStoreAppUtils.ps1:164 char:5

Finally I try to build the app and install it using: ionic build windows. This builds the appx packages and I am able to successfully install it but when I try to run the app it immediately crashes. In the application logs I get the following error:

Activation of the app com.ionicframework.test12971464_h35559jr9hy9m!com.ionicframework.test12971464 for the Windows.Launch contract failed with error: The remote procedure call failed…

I create the app using the following command: ionic start test --v2
I then add the windows platform with this command: ionic platform add windows
I then add the following line to the config.xml file to build a Windows 10 Universal app: <preference name="windows-target-version" value="10.0" />

Does anyone have any suggestions on how I can build a Windows 10 app with Ionic 2 RC? Am I missing a step somewhere?

EDIT: Additional information I am using a Windows 10 Pro and Windows 10 Enterprise machines both with Windows 10 version 1607.

Thanks

Not sure if this information helps with determining the issue with building and running a Windows 10 app but if I take out the <preference name="windows-target-version" value="10.0" /> line out of the config.xml file I am able to run the app with theionic run windows command. I am also able to build the application and install it using ionic build windows command.
The applications that is built without the preference line in the config.xml file is a Windows 8 app and not a Windows 10 universal app which really doesn’t help me (I need to use some windows 10 specific APIs in my custom Cordova plugins) but I thought the information may assists in figuring out what is wrong.
Any help or suggestion would be greatly appreciated.

http://cordova.apache.org/docs/en/latest/guide/platforms/win8/index.html#project-configuration

Thank you for the reply but I believe I am already doing everything in the article you sent.

I might be missing something obvious (wouldn’t be the first time) but it appears that I am doing everything mentioned in that link. the only difference that I see is I am running ionic run windows while the article says to run cordova run windows.

I am already putting the preference line in the config.xml file. Do I need to use the cordova command rather than the ionic? I plan on trying that when I get to the office in the morning but I have always used the ionic commands in the past. Also the Windows 8 and 8.1 app builds/runs correctly with the ionic command it is only once I add the <preference name="windows-target-version" value="10.0" /> line to the config.xml file (to create a Windows 10 app) that I get the errors.

If I am missing something please let me know.

After my tests this morning I do not believe this is a problem with cordova and unless you have an objection I will open another issue in ionic’s github site. Here is what I did this morning and if I am missing something, please let me know.

I created a pure Cordova project as outlined in the link. Here are the steps I did:

  • crodova create Hello hoffman.jon.Hello
  • cd Hello
  • cordova platform add windows –save
  • {added <preference name="windows-target-version" value="10.0" /> to the config.xml file }
    When I ran the project with cordova run windows command, the project starts up fine and I see the Cordova “Device is Ready” screen

The I go though the setup with ionic 2 using these steps:

  • ionic start test125 –v2

  • cd test125

  • ionic platform add windows

  • {added <preference name="windows-target-version" value="10.0" /> to the config.xml file }
    When I ran the project with ionic run windows command, the project attempts to start but immediately crashes with the following error:

    Exception calling “ActivateApplication” with “4” argument(s): "The remote procedure call failed. (Exception from
    HRESULT: 0x800706BE)"
    At C:\Users\jhoffman\Documents\ionictest\test125\platforms\windows\cordova\lib\WindowsStoreAppUtils.ps1:164 char:5

    • $appActivator.ActivateApplication($applicationUserModelId,$null,[ ...
      
    • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      • CategoryInfo : NotSpecified: (:slight_smile: [], MethodInvocationException
      • FullyQualifiedErrorId : COMException

If I remove the <preference name="windows-target-version" value="10.0" /> line from the config.xml file and run the ionic run windows command the project starts up correctly.

I am running Cordova 6.4.0 with ionic version 2.1.8. If I am missing something, please let me know. Thanks

Thanks again for the reply but I am still unable to resolve this issue. Would you have any suggestions based on my reply to your post or should I open a new issue on this?

I have updated Ionic to:
Ionic CLI: 2.1.12
Ionic App Lib: 2.1.7
and I have the same problem with that version as well.

Not sure if I should update the issue and the post. If I only need to update one, please let me know otherwise I will update both.
Thanks

I am in the exact same situation:

  • my app crashes immediately after splashscreen
  • Same error message

confirm this issue. minimal cmd steps to reproduce:

ionic start somename tabs --v2
cd somename
ionic serve // runs nicely
ionic platform add windows
ionic build windows // runs nicely, package is generated, but the application closes emmidiately (0.4secs maybe) after showing the cordova splashscreen
ionic run windows
Exception calling “ActivateApplication” with “4” argument(s): "The remote procedure call failed. (Exception from

HRESULT: 0x800706BE)"
At D:\path\platforms\windows\cordova\lib\WindowsStoreAppUtils.ps1:164 char:5

  • $appActivator.ActivateApplication($applicationUserModelId,$null,[ ...
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:slight_smile: , MethodInvocationException
    • FullyQualifiedErrorId : COMException

no idea how to fix it though, still trying :slight_smile:

  • this is of course after <preference name="windows-target-version" value="10.0" />
    has been added , w/o it application runs just fine (while doing build for 8.1, not run command, which is weird, but ok).

+1 here same problem

I tried to open the cordova solution in platform\windows in visual studio 2015 and ran it in debug mode.
I catched an error before app crash and it is in polyfill.js (3,16552)
SCRIPT-1: Unhandled exception at line 3, column 16552 in ms-appx-web: //PATH/www/build/polyfills.js 0x8000ffff - JavaScript runtime error: Required argument

I think we are in the same case than: https://github.com/driftyco/ionic/issues/9051
We need to wait next Release Candidate

Is it safe to assume the fix will be in the next RC? Also any idea when the next RC will be released?

Really i don’t know, we can just cross fingers…
For me it is a major issue because all Windows 10 Desktop and mobile Apps can’t be executed and we have no workaround

Can you confirm that you are able to create and run a new universal windows app in Visual Studio normally?

I can confirm that with the Windows 10 SDK installed in Visual studio and with the following preference added to config.xml that my app builds and runs using ‘ionic run windows’: Check your system information using ‘ionic info’.

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

System information:

Cordova CLI: 6.3.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.12
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.46
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.1

Also, the output of ‘cordova platforms’ is:

Installed platforms:
  browser 4.1.0
  windows 4.4.3

Hello webprofusion,

I confirm that i can create, build and run a classic windows 10 blank Universal app in visual studio 2015

I have this in my config.xml:

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

When i compile for Windows 10 Desktop, i use: ionic build windows --release --arch=x64
For windows 10 Mobile, i use: ionic build windows --release --arch=arm

  • For the 2 cases the app build but crash on launch (On my Desktop and on my Lumia 950XL)
  • This problem occurs with my migrated RC0 app but also with a new fresh ionic app (tested with sidemenu template)
  • The problem is the same on 2 different computers (same config)
  • As i remember there was not problem in RC0
  • Android is compile and launch well

Ionic info returns:

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.13
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.46
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.1
Xcode version: Not installed

Cordova platforms return:

Installed platforms:
  android 5.2.2
  windows 4.4.3

In the issue i linked, it seems to be a problem of compatibility between polyfill.js and Microsoft Edge WebView

Since replying last I’ve tried this on a different app on a different Windows 10 machine (home edition in this case).I now get the same issue you do. There does indeed seem to be a syntax issue with the polyfill.js (https://github.com/driftyco/ionic/issues/9267)

Would the polyfill.js issue fix the error I get when I attempt to run create/run a Windows 10 application outside of Visual Studios? I am not getting the polyfill.js error when I use the command line tools to create the project and run it. The error I get is:

ActivateApplication: com.ionicframework.testrc2409568_h35559jr9hy9m!com.ionicframework.testrc2409568

Exception calling “ActivateApplication” with “4” argument(s): "The remote procedure call failed. (Exception from

HRESULT: 0x800706BE)"
At J:\ionic_projects\RC2\testrc2\platforms\windows\cordova\lib\WindowsStoreAppUtils.ps1:164 char:5

  • $appActivator.ActivateApplication($applicationUserModelId,$null,[ ...
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (: ) , MethodInvocationException
    • FullyQualifiedErrorId : COMException

I create/run the project with the following steps:

create the app using the following command: ionic start test --v2
add the windows platform with this command: ionic platform add windows
add the following line to the config.xml file to build a Windows 10 Universal app:
run the app: ionic run windows

My Platform:

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.12
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.45
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v4.4.7
Xcode version: Not installed

It is the same issue,

In simple words, with Visual Studio, we have just more details because of javascript debug (code highlight where the exception is catched).

You have just an error saying your command line lost communication with app ^^

Great, thank you for clearing that up.