Friday, October 28, 2016

Building and deploying an Apache Cordova app using Visual Studio 2015 Community Update 3

Visual Studio 2015 Community is a free Comprehensive Windows IDE from Microsoft. You can develop both web apps as well as native apps. It is also cross-platform. Besides these you can develop a whole lot other types of projects including Databases and IoT.

Besides Visual Studio 2015 Community there are other IDEs that cover cross-platform app development using HTML5,CSS and JavaScript such as Intel XDK. Visual Studio 2015 or(VS 2013) address a whole lot of technology besides web and mobile. Here it is not the intention to compare or contrast but mention the availability. If there is a requirement for a simpler IDE then perhaps Intel XDK could be an option where as Visual Studio would require a steeper learning curve.

This post deals with creating a Apache Cordova app using Visual Studio 2015 Community Update 3.
In the New Project... window you find only one template, a Blank App available for developing a Apache Cordova JavaScript based app.


If you accept the default blank project you would see the following in the Solution Explorer.


The project can be developed at least for two platforms Android and Windows unless scripts are not needed for WP8 and IOS devices.

By default when you try to build this project, the IDE builds it for Android. The build process is lengthy and takes some time. As this computer does not have Google Chrome installed when you try to Start Debugging, you will get the following error:
Severity Code Description Project File Line Source Suppression State
Error  Error: DEP10401 : The Ripple emulator requires Google Chrome to launch your app, but Chrome is not installed on this computer. Please install it from: BlankCordovaApp_0   IntelliSense
In order to test this blank project you need the Ripple emulator.

However one can direct debug target to another device Windows Universal (for example).

In order to build for Windows Universal we can change it from the Project's Property page (Menu Project | Project Properties) as shown:

However when you try to run this you get this error:

Most of these errors are related to not choosing the right debug target device / emulator.

Windows as deploy target:

Windows Emulators run in Hyper-V and that needs to be working as the next message shows trying to work with Windows 10. This message is strange as Hyper-V is enabled. However, there
must have been a Windows 10 update which probably resets other settings.

I enabled Hyper-V using the Control Panel. However, you also need to restart the computer.

 As I had launched the Visual Studio as a normal user, it needs to run in elevated mode.

 Well. I still get this error message and cannot run..

 I changed my emulator to Windows x64 and the program ran without any errors and the emulator image is shown below.

 I tried to run in Window Phone emulator and it came up with many other errors. This one is hard to run in Windows 10 emulator.

 I am not sure what this error message is about. I wish there were more helpful messages.

Finally I ran the start debug for Window Phone with the Emulator 8.1 WVGA 4 inch 512 mode and the program ran without errors.

I have to see how it runs in other emulators/devices. Let you know in another post.

No comments: Protection Status