9

Click here to load reader

Deploying Enterprise Cordova Windows Phone Apps

Embed Size (px)

Citation preview

Page 1: Deploying Enterprise Cordova Windows Phone Apps

Deploying Enterprise Cordova Windows Phone AppsAdam Birr

Page 2: Deploying Enterprise Cordova Windows Phone Apps

Problems Out of the box Cordova Windows Phone project has the following enterprise

issues: Airwatch upload didn’t recognise the Appx file as a Windows Phone app Dependencies not automatically downloaded Requires a redundant dummy DLL which is only used to sign the app Product ID not configurable Intune can only upgrade Appx files and not Appxbundles

Page 3: Deploying Enterprise Cordova Windows Phone Apps

Fixing Cordova Two options

1. Fix default Cordova template to handle enterprise deployment Push our changes back to the open source community2. Alter the Cordova build after the default template is pulled down using the built in

hook mechanism Chose option 2

No delays in waiting for approval from community Hook mechanism easy to understand – allows custom code to be executed during various

points of the execution process Implemented a number of pre-compile hooks Hooks written in Javascript executed by Nodejs

Page 4: Deploying Enterprise Cordova Windows Phone Apps

Uploading Windows Phone Appx files to Airwatch Airwatch expects the TargetFrameworkMoniker build:Item to be present in the

AppxManifest AppxManifest is a generated artifact of the MSBuild process Solution:

Write a Cordova Windows pre-compile hook to alter the CordovaApp.Phone.jsproj file Added:<TargetFrameworkIdentifier>WindowsPhoneApp</TargetFrameworkIdentifier><TargetFrameworkVersion>8.1</TargetFrameworkVersion>to the section:<PropertyGroup Label=“Configuration”>

Page 5: Deploying Enterprise Cordova Windows Phone Apps

Dependencies not automatically downloaded Enterprise Windows app do not automatically download Javascript dependencies Cordova requires the WinJS dependency to enable it to launch a webview Solution:

Download the latest version of the WinJS library Write a Windows pre-compile hook to add files to the Cordova Windows template Alter the index.html file of the app to reference the WinJS files included in the project

Page 6: Deploying Enterprise Cordova Windows Phone Apps

Redundant dummy DLL Required for the sign process in order to produce a CodeIntegrity.cat file In order to make the code upgradable, the DLL must have a different version

number and have a code change for each new app version Solution

Create a simple DLL project in Visual Studio with a simple class file Write a Cordova Windows pre-compile hook which

Adds a new method to the simple class file Alters the version number of the DLL Compiles the DLL using MSBuild Adds the resultant artifact to default Cordova Windows Template

Page 7: Deploying Enterprise Cordova Windows Phone Apps

Configurable Phone Product ID Microsoft Intune identified an application’s uniqueness by the phone product ID

GUID found in the AppxManifest file Windows Cordova template generates a new product ID for every build Solution:

Write a Windows Cordova pre-compile hook to take a configurable product ID GUID

Page 8: Deploying Enterprise Cordova Windows Phone Apps

Intune can only upgrade Appx files Cordova builds an Appxbundle by default Appxbundles contain multiple Appx files, often for internationalisation Airwatch can only upload Appx files and Intune can only upgrade Appx files Solution:

Write a Windows Cordova pre-compile hook Add <AppxBundle>Never</AppxBundle> to the CordovaApp.Phone.jsproj file

Page 9: Deploying Enterprise Cordova Windows Phone Apps

Conclusion Just because Microsoft supports Cordova and has Cordova templates built into

Visual Studio, it does not mean it will be compatible with Microsoft’s Intune MDM when used out of the box

Cordova Hooks can be very useful Alter the jsproj file to change what is put into the Appxmanifest file