Chapter 3. Windows
3.1. Deploying an App on Windows Phone 8
Different deployment options are available depending on the types of the Windows Phone 8 apps.
3.1.1. Non-company Windows Phone 8 Apps
Unless an app binary is signed by a Windows Phone company certificate, the app will be non-company app. Non-company Windows Phone 8 apps cannot be OTA installed on to devices directly.
3.1.1.1. Building
Using Visual Studio
In Visual Studio, if no signing options are specified, the final binary will be a non-company app.
Using the App Studio
When using the App Studio to build for Windows Phone, if the "Don’t sign the binary" option is selected, the final app binary won’t be signed and it will be a non-company app.
3.1.1.2. Distribution & Deployment
Normally you will have two options to distribute and deploy this type of apps:
Using the Application Deployment Tool provided by the Windows Phone SDK
This option is mainly for development testing. If you have Windows Phone SDK installed on a computer, and the target device is a developer registered device, you can deploy WP apps using the Application Deployment Tool.
Using the Windows Phone App Store
You can publish the app to the Windows Phone App Store and distribute from there.
3.1.2. Company Windows Phone 8 Apps
A non-company app will become a company app once it’s been signed by a Windows Phone Enterprise Certificate. Company apps can be OTA installed on to devices directly and bypassing the app store completely.
To build company apps using the App Studio, you should follow these steps:
3.1.2.1. Acquiring the enterprise certificate
Following these steps to get your enterprise certificate:
- Follow the steps in the Publish Windows apps guide to create a company Windows Phone developer account. Make sure the account type is "Company". This will cost $99 per year. It may take a few days to process as your company information will be validated.
- Once your developer account is setup, visit the Enterprise Mobile Code Signing Certificate to apply for the certificate file. Specify the "Publisher ID" field as provided by your Windows Phone developer account. This will cost $299 per year.
Once the process is completed, Symantec will deliver a certificate that can be imported into the certificate store on a computer. See Certificate install instructions.
TipUse the same computer when requesting and picking up the certificate from Symantec.
- Finally, you should export the certificate with its private key as a PFX file and protect it with a password. See the Export a Certificate with the Private Key guide for instructions.
Check out the Company app distribution for Windows Phone guide for more details.
3.1.2.2. Generating the application enrollment token (AET)
Only the phones enrolled in your company account can OTA install apps signed by your enterprise certificate. To enroll devices, you need to generate the application enrollment token (AET) and install it on those devices.
You can follow the steps in the How to generate an application enrollment token for Windows Phone guide to generate the AET file manually.
Alternatively, the App Studio can generate the AET file for you during the next step.
To install the AET file on to devices, the easiest way is to store the AET on a web server and ask your users to download it using their devices' web browser. The App Studio can help with that as you will see in the next few steps.
3.1.2.3. Creating a credential bundle for Windows Phone
Once the certificate is available, you can create a new credential bundle in the App Studio.
As you can see in the screenshot, the App Studio can generate the AET file for you. However, if you have the AET file already, you can choose to upload it instead. If you choose to manage the AET file yourself, make sure the AET file is installed on your users' devices.
3.1.2.4. Build the app and sign it with the credential bundle
When building an app for Windows Phone in the App Studio, you will have the options to sign the app binary with the credential bundles you just uploaded.
3.1.2.5. Distribution & Deployment
Once the app finishes building, there will be OTA link and QR code on the download page to easily install it to the users' devices. If the AET file is available as part of the credential bundle, there will be download link & QR code for it as well.
3.2. Support for Windows Platforms
Red Hat Mobile Application Platfrom (RHMAP) supports the development of Client Apps for Windows-based devices. For a detailed tutorial, see Developing Forms Apps and Cordova Apps for Windows.
3.2.1. Supported Platforms
The current version of RHMAP targets Windows Phone version 8 and higher. Workarounds for platform-specific issues are provided further in this guide.
Windows 10 Universal Apps (Phone, Tablet and Desktop):
Full support, except:
- Apps can’t be built in the RHMAP and must be built locally
Windows 8.1 Universal Apps (Phone, Tablet and Desktop):
Full support, except:
- Apps can’t be built in the RHMAP and must be built locally
- Cordova apps need a small workaround to enable support for dynamic content
Windows Phone 8.1:
- Full support
-
Windows Phone 7,7.5 and older,
-
Windows 8 Pro for Tablets,
-
Windows 8 RT for Tablets,
3.2.2. Building Windows Apps Locally
Due to changes in Microsoft’s licensing of its development tools, it is currently not possible to build Apps for Windows 8.1 and Windows 10 directly in RHMAP. RHMAP apps for the affected platforms have to be built manually in your local development environment.
First, clone the repository of your Client App.
git clone <Git_URL>
- Locate the solution file (.sln) in the project folder and open it in Visual Studio.
- In Visual Studio, select a solution configuration and platform and build the project by pressing the F7 key. For more details, see the official documentation: Building a Windows Phone app in Visual Studio.
-
Once the build is finished, a binary with a
.xapor.appxextension will be located at<project_name>/<solution_name>/Bin/<solution_configuration>. The binary file can be deployed to Windows devices or uploaded to the RHMAP App Store.
3.2.3. Enabling Dynamic Content in Cordova on Windows 8.1
On Windows 8.1, security restrictions are in place that prevent apps from using properties such as innerHTML and outerHTML. This in turn prevents any dynamic content to be injected and most JavaScript frameworks will therefore fail to function properly. This also prevents Cordova apps and RHMAP drag and drop apps from functioning.
A workaround for this issue is to reference a single JavaScript file provided by Microsoft, which relaxes the security restriction:
-
Download the
winstore-jscompat.jsfile: https://raw.githubusercontent.com/MSOpenTech/winstore-jscompat/master/winstore-jscompat.js. -
Copy the
winstore-jscompat.jsfile into thewwwfolder of your project Reference the file from any HTML that requires dynamic content manipulation.
winstore-jscompat.jsmust be referenced before any other JavaScript framework includingcordova.jsorfeedhenry.js.<!-- above feedhenry.js or cordova.js--> <script src="winstore-jscompat.js" type="text/javascript"></script>
For more information about this workaround, see the description in the MSOpenTech/winstore-jscompat repository.
3.3. Developing Forms Apps and Cordova Apps for Windows
Overview
This tutorial shows you how to create a Forms app targeting the Windows platform using Red Hat Mobile Application Platform Hosted (RHMAP). The same steps as demonstrated in this tutorial also apply to any Cordova app, not just Forms apps.
Currently, there are several issues preventing support for the Windows platform equivalent to the other platforms, as described in Support for Windows Platforms. Specifically, native Windows 8.1 and Windows 10 apps can’t be built by the Platform and have to be built manually. Also, Cordova apps need a small workaround to work properly in Windows 8.1.
This tutorial is also available as a quick video walkthrough.
Requirements
- Windows 8.1 or Windows 10
- 32 or 64-bit machine with minimum 4 GB of RAM
- Visual Studio 2013 Express or higher
- An existing Forms app or a Cordova app in the Platform. See the Create a Forms Project guide for help with creating a Forms app.
3.3.1. Steps
3.3.1.1. Initial Setup
Download and install Node.js: https://nodejs.org/en/download/.
There’s an installer available which guides you through the setup. Make sure to include the npm package manager in the installation. It’s a core component which will also be required further in this guide.
Download and install a git client: https://git-scm.com/download/win/.
Aside from thegitexecutable itself, the installer of Git for Windows also provides an emulated Bash shell (called Git Bash) and a set of command-line tools in order to provide a familiar development environment. To learn more about the Git for Windows project, see the official website of Git for Windows.NoteMost steps in this guide involving the use of command line can use
cmdor PowerShell, unless otherwise noted. However, we suggest using the Git Bash command line installed in this step for all the steps.Install the Cordova package.
npm install -g cordova
This installs the Cordova package including a
cordovaexecutable globally and thus makes it available to all Node.js applications.Clone the repository of your app from the Platform.
Clone the repository of your app:
git clone <git-ssh-clone-url-of-your-app>
The Git SSH Clone URL of your app can be found in the App Details.
3.3.1.2. Cordova Setup
Normally, Cordova projects are automatically created for your Cordova apps during build in the Platform and the Cordova-specific files and folders are not available in the app’s repository. However, when building manually, the Cordova files need to be created and command invoked manually.
Forms apps are based on Cordova and as such they need the same procedure for building as Cordova apps.
Create a Cordova project.
We use the name winforms in this example, but it can be an arbitrary name.
cordova create winforms --copy-from <location-of-forms-app>\www
This creates a new Cordova project and copies the assets from the
wwwdirectory into the newly created project’swwwdirectory.Windows 8.1 only: Apply workaround for dynamic content manipulation in Cordova apps.
See Enabling Dynamic Content in Cordova on Windows 8.1 for more information.
git clone https://github.com/MSOpenTech/winstore-jscompat.git copy winstore-jscompat\winstore-jscompat.js forms\www
The
winstore-jscompat.jsmust be included in every HTML file in your Cordova app which does dynamic content manipulation.<meta name="format-detection" content="telephone=no"> <!-- these three js files should be included exactly in this order --> <script src="winstore-jscompat.js" type="text/javascript"></script> <script src="cordova.js" type="text/javascript"></script> <script src="feedhenry.js" type="text/javascript"></script>
Add the
windowsplatform to the Cordova project.cd winforms cordova platform add windows
This creates all the source files necessary to build the binary, including a Solution File (.sln) which can be used to import the project into Visual Studio.
Add the default Cordova plugins.
cordova plugin add \ cordova-plugin-file \ cordova-plugin-camera \ cordova-plugin-file-transfer \ cordova-plugin-device \ cordova-plugin-network-information \ cordova-plugin-battery-status \ cordova-plugin-device-motion \ cordova-plugin-device-orientation \ cordova-plugin-geolocation \ cordova-plugin-media \ cordova-plugin-media-capture \ cordova-plugin-dialogs \ cordova-plugin-vibration \ cordova-plugin-contacts \ cordova-plugin-globalization \ cordova-plugin-inappbrowser \ cordova-plugin-console \ https://github.com/fheng/fh-cordova-plugins-api.git
3.3.1.3. Building the Binary
The app binary can be built from the command line using Cordova or from Visual Studio and supports both Windows 8.1 and Windows 10.
To build using Cordova:
cordova build
To build using Visual Studio, import the solution file (.sln) created in previous step into Visual Studio and build the solution. See Building Windows Apps Locally for details.
Cordova also provides the ability to start an emulator to quickly see the app running:
cordova emulate

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.