April 30th, 2015

Introducing the Windows 10 Apache Cordova platform

Apache Cordova allows developers to write apps targeting iOS, Android, Windows, and Windows Phone with a single codebase using HTML, JavaScript, and CSS. Today, Apache Cordova support for Windows 10 is available for developers to begin experimenting with building Cordova apps that support the Universal Windows platform.

The new Universal Windows platform allows developers to target a variety of Windows 10 devices with a single app deployed to the Windows Store. While Cordova allows developers to build apps for multiple platforms with apps native to each platform using a single codebase, the Universal Windows platform takes it one step further for Windows 10 devices and allows a single app to work across a breadth of devices, such as phone, tablet, desktop, and Xbox. Cordova apps that target the Windows 10 platform can take advantage of all the new features of Windows 10, such as Cortana integration. While your Windows 8.1 apps will continue to work with full fidelity on Windows 10, changes to the security model for Windows Web apps in Windows 10 allow developers to write apps targeting Windows 10 in a way more natural to web programming styles. For instance, new security policy changes mean that you can use the JavaScript libraries you love, such as Angular and Bootstrap, while still having the power of direct access to the Windows Runtime Library (WinRT).

Until the Windows App Store is ready to accept Windows 10 apps, you can use the platform to prototype and refine your Cordova app. Between now and Windows 10’s release which is coming soon, some commands will require the developer to use the command-line. When Windows 10 is released, Visual Studio 2015 will support the Windows 10 Cordova platform without requiring developers to use the command line to add or manage their platform code.

Below are detailed instructions to set up and use the Windows 10 platform. You can open a command line in Windows with Windows Key+R, then typing “cmd”.

Installation Prerequisites

npm install –g cordova

You can verify your version by running: cordova –version

The next sections detail adding the Windows 10 Cordova platform to your project. Alternatively, to get started immediately use the Blank Apache Cordova Template with Windows 10 Support from the Visual Studio Gallery. The Blank Apache Cordova Template with Windows 10 Support is a blank project template that includes the Windows 10 platform by default.

Using the Cordova platform

The next step is to use the platform. If you have an existing project that you’d like to add Windows 10 support to, skip down to “Adding the Windows 10 platform to your Cordova project”.

Create a new Cordova project

Open Visual Studio and create a new project using the File->New->Project menu and use the Apache Cordova Blank App template to create a new Cordova project.

Adding the Windows 10 platform to your Cordova project

Once you’ve created your project, the config.xml file will open where you can add the new Windows 10 platform to your project. Visual Studio needs to use Cordova CLI version 5.0.0 or later. If this isn’t the version you have, you can update the CLI version in the configuration designer by double-clicking on config.xml in the Solution Explorer. To update the Cordova CLI selection to 5.0.0, choose the Platforms tab on the left and enter the number 5.0.0 in the text box, as shown below:

Select Cordova CLI version 5.0.0 Save your changes and close the configuration designer using the X in the tab strip. Then build the solution using the Build à Build Solution menu item.

For the next step, you’ll need to use the command line. When Visual Studio ships, you’ll be able to perform this step in Visual Studio.

Using Visual Studio, reopen the configuration designer by double-clicking on config.xml in the Solution Explorer. In the Windows tab, change Windows Target Version to Windows 10.0.

Add Windows 10 Platform to your Cordova Project

Build and Run the app

To build and run for Windows 10, choose the build target Windows-AnyCPU and the deployment target Local Machine, then choose run. You should see your app running.

Learn More

You can find more information on building for and using the Windows 10 Cordova platform on the Apache Cordova site. If you’d like to learn more about building Universal Windows app targeting a variety of Windows 10 devices, refer to Windows Dev Center.

We’re looking for your feedback to make the Cordova Windows 10 platform better. If you’re a Cordova app developer, please use the platform and Visual Studio and ask questions or give us feedback. If you’re a Cordova community member, we’d love issue reports and feedback on how we’ve implemented the Windows 10 platform (please use the Windows10 tag). We look forward to hearing from you.

 

image Polita Paulus, Principal Program Manager, Visual Studio Client @vscordovatoolsPolita Paulus is a Principal PM Manager on the Visual Studio Client team working on TypeScript, Tools for Apache Cordova, and the JavaScript Language Service. Over the years, she’s worked on several projects, mostly centered around making web developers’ lives a little better. Outside of work, she likes bikes and running.

Author

Visual Studio has been around since 1997 when it first released many of its programming tools in a bundle. Back then it came in 2 editions - Visual Studio Professional and Visual Studio Enterprise. Since then the family has expanded to include many more products, tools, and services.

0 comments

Discussion are closed.