Sunday, December 7, 2014

Apache Cordova - Makeshift project template for Visual Studio 2013 (Windows development)

****The information contained here is just a personal excursion and no liability, implied or express, will be entertained. Use at your own risk****

Skip to the end to jump to the github link for the template files if you want to give the grueling details a miss.


I've been wracking my head to find an Apache Cordova project template for Visual Studio. I am following along with the MVA (Microsoft Virtual Academy)'s - Developing 2D Games with HTML5 video tutorial. **note Cordova, formerly PhoneGap, requires Node.js installed, and is currently deployed using ndm(node packaged modules) and might require some level of git repository, neither of which are discussed here**


As often as happened with MVA tutorials, the specifics of setting up a system or framework has already changed since the video was released. And being there's no feedback system in MVA, user issues and such are voiced elsewhere, disparately. It's not only hard to find but ascertain whether issues noted elsewhere are directly based on what you might land on from the video.

Now a slight hitch I ran into intially was not being able to create Windows 8 template files to drop into Visual Studio to start a project/tutorial/session what have you. The video explains downloading the zip file containing the Cordova templating instructions (I'm assuming) and then running a batch file called "createTemplates." Even though the video gives a direct link to download the exact version they refer to and have used in the tutorial, when you download it no such file exists. **As explained, the current setup requires that you install Cordova using ndm from the command line.**

So what is one to do, when one is a stickler for coloring inside the lines? Well usually just go a bit out of the lines and come back in the lines when you can. The current method of creating projects is using the CLI, steps can be found here website. But I thought it was handier just being able to open up Visual Studio and creating a new project.

So what I did was create my own template file by extracting choice bits from the sample project that's created as described in the above mentioned link and using a version of windows 8 distro  found on their site.

I have yet to test it and use it, but so far it loads without any errors when I create a new project using the template. I've tried using other distros of files which contains the original 'createTemplates.bat' file but after it created the designated template and was inserted into the Visual Studio's template folder, it failed to load with a handful of errors. So hopefully this will help ease the process for anyone who's stuck or doesn't like to use the command line to dally about creating projects.

The template files can be found on my github repo : https://github.com/donyd/CordovaWP8

Related articles