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”.
- Windows 10 Technical Preview 2
- Visual Studio 2015 RC
- From the command line, install Cordova globally. If you have a version already, run the command to ensure you have version 5.0.0 or greater:
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:
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.
- cd BlankCordovaApp1\BlankCordovaApp1
- cordova platform remove windows
- cordova platform add “windows@https://aka.ms/cordova-win10”
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.
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.
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.
|Polita Paulus, Principal Program Manager, Visual Studio Client