Windows Phone 8 Platform Guide
This guide shows how to set up your SDK development environment to deploy Cordova apps for Windows Phone 8 devices. If you want to target both 7.5 and 8 devices, develope for Windows Phone 7 instead as detailed in the Windows Phone 7 Platform Guide. Version 7 does not have all the advanced features included in IE10, but implements the same set of APIs. Windows Phone 8 apps do not run on Windows Phone 7 devices.
See the following for more detailed platform-specific information that applies to both versions:
The command-line tools above refer to versions prior to Cordova 3.0. See The Command-line Interface for information about the current interface.
1. System Requirements
- Windows 8 or Windows 8 Pro
- The 64-bit version (x64) of Windows is required for the SDK.
- The Pro version is recommended so you can run a device emulator.
- Windows 8 or Windows 8 Pro
- 6.5 GB of free hard disk space
- 4 GB RAM
- 64-bit (x64) CPU
Windows Phone 8 Emulator
- The phone emulator uses Hyper-V, so this list includes those pre-requisites.
- Windows 8 Pro 64-bit edition or greater
- Requires a processor that supports virtualization and Second Level Address Translation (SLAT)
- Enable the virtualization capability (i.e., VT-x on Intel) in your BIOS settings, as usually this is disabled by default.
SDK + IDE (Visual Studio)
- Visual Studio 2012 Professional, Premium, or Ultimate. Note that Visual Studio Express for Windows Phone (included in the SDK) is not recommended because you can not build the template (see below) with VS Express, as it does not have the Export Template functionality, which is only in VS Pro or higher.
Register and pay for a Windows Phone Dev Center account if you want to install your app on a real device or submit it to Market Place.
NOTE: Running the SDK in Virtual Machine might present some challenges. You can read this blog post that gives insight on the solutions to develop for Windows Phone on a Mac.
2. Install SDK + Cordova
Download and install Windows Phone SDK
Download and extract the latest copy of Cordova. You will be working in the
lib\windows-phone-8\wp7contains the Windwos Phone 7 version of Cordova.
Copy the file CordovaWP8xx_x.zip to the folder : \My Documents\Visual Studio 2012\Templates\ProjectTemplates\
2.1. Building the template
NOTE: this step may not be required. If the lib\windows-phone directory already contains a file CordovaWP8xx_x.zip then you may skip this step.
In order to simplify the development process, Cordova comes with a script to build Visual Studio templates. This allows for rapid creation of Cordova applications inside Visual Studio. This template can be modified if needed and the below steps indicate how to proceed if you want to generate the template.
Run the batch file to create and install the templates.
The root of the repo contains a file createTemplates.bat. Double clicking this file will generate 2 .zip files. (CordovaWP7xxx.zip + CordovaWP8xxx.zip where 3.0.0 is the current version number) To easily use these files in Visual Studio, copy them to "My Documents\Visual Studio 2012\Templates\ProjectTemplates\" You will then be able to create new Apache Cordova Windows Phone apps from the Visual Studio File->New Project menu.
If you run the batch file from the command line, you can also call with a parameter to install automatically
Run the script :
3. Set up New Project
Open Visual Studio Express for Windows Phone and choose New Project.
Select CordovaWP8. (The version number is displayed in the template description.)
Give the project a name, and select OK.
4. Review the project structure
wwwfolder contains your Cordova
html/js/cssand any other resources included in your app.
Any content that you add here needs to be a part of the Visual Studio project, and it must be set as content.
Note: This screen capture was from the cordova-2.3.0 download, your listing will vary based on the actual version installed.
5. Build and Deploy to Emulator
Make sure Windows Phone Emulator is selected in the main drop-down menu.
Press the green play button next to the drop-down menu to start debugging, or type F5.
6. Build your project for the device
In order to test your application on a device, the device must be registered. Click here to read documentation on deploying and testing on your Windows Phone 8.
Make sure your phone is connected, and the screen is unlocked.
In Visual Studio, select 'Device' from the top drop-down menu.
Press the green play button next to the main drop-down menu to start debugging, or type F5.
For more details on the specific differences between IE10 and WebKit browsers, and how to support both MS has a helpful guide here