How to get Apache Cordova working with Visual Studio/Windows Phone Emulator

I spent a wasteful amount of time on this, so I wanted to write down what went wrong – both for Future Robert, and anyone else who might be trying to do this. This is what I did to get Windows Phone emulators working with Visual Studio 2015 on Windows 10, on an HP Envy laptop with hardware virtualization.

By the way – Apache Cordova in Visual Studio otherwise works – I only had an issue with the Windows Phone emulator, which is explained below.

The Setup:
Since I’ve been in the “rebuilding” spirit – with rebuilding my main dev VM, and then my main workstation – I wanted to get my laptop working. In particular, there is one thing I can NOT do with a development workstation virtual machine – and that is, run Windows Phone and Windows Store emulators.

For that, I need a real, physical machine. That’s fine, because that’s how I was using my laptop before. So – let me get the latest and greatest!

I get everything installed – including Hyper-V, which is how Visual Studio does their Windows Phone emulators. However, during the install of Visual Studio I see this:

image

well, that’s not great. So, I try to download JUST the WP8 emulators from here: https://www.microsoft.com/en-us/download/details.aspx?id=43719 – when I try to install this, I immediately get this error:

image

It says that it requires Windows 8.1 Pro, 64-bit, and Hyper-V. I’m running Windows 10 Enterprise, 64-bit, and have Hyper-V installed!

Hardware Virtualization and Hyper-V:
I have a HP Envy laptop – which comes with this ridiculously-simple BIOS. So, the only options I have for hardware virtualization are on and off:

WP_20150525_21_29_29_Pro

In the past, this ALWAYS needed to be disabled. With both Windows 8 and Windows 10, if ever I enable this (with or without Hyper-V installed) – the boot screen just hangs. The screen where you see the circle-spinny-thing just stays on the screen forever.

While researching that, people recommend turning on/off specific hardware virtualization features – but as you can see, all I have available is this Fisher-PriceMy First Bios!” (joke: meaning, simple and made for children).

Hyper-V WITHOUT Hardware Virtualization:
The obvious answer to me was just to disable hardware virtualization and install Hyper-V. That works with Windows 8.x and Windows 10. I did that, but I was still getting an error message from the Emulator installer. They point to two sets of requirements:

No matter what I tried, I could not get past that error. Hyper-V is installed and works – but the emulators installer is just convinced that Hyper-V just won’t work!

Hyper-V WITH Hardware Virtualization:
So, as a last resort and to see if I could troubleshoot further, I went back into the BIOS and enabled hardware virtualization. A minute later I look back over and I see the Windows login screen. What the? For some strange reason, it did not hang Windows this time! I enabled hardware virtualization and it actually booted – that is a first, for this laptop!

There are two things I did which might account for this – I went to http://support.hp.com and found my specific model:

  1. I upgraded to the latest BIOS firmware.
  2. I installed all of the software/drivers they had (including chipset drivers)

I’ll take it! So, I log in – kick off the installer and no error!

image

and sure enough, the emulator works!

image

Well, it works with a Windows Phone project in Visual Studio. What about Cordova?

Getting Apache Cordova to work with the Windows Phone emulator:
Well, once the emulators are installed – if you create a new Apache Cordova project:

image

then, when you choose Windows Phone 8 from the dropdown in the toolbar:

image

and choose a Windows Phone 8 emulator:

image

it will either boot up that particular emulator in Hyper-V or create a new VM, and then start it up:

image

What about Windows Phone 10?
Now, you might have noticed that if you choose “Windows Phone (Universal)”:

image

that in addition to Windows 8.1 emulators, there are also Windows Phone 10 ones listed. If you choose one of those, you’ll get a deployment error in Visual Studio saying the device is not found.

This is because you need to download the Windows Phone 10 emulator. You can get that from here:

Windows Phone 10 Emulator Download for VS2015
https://www.microsoft.com/en-us/download/details.aspx?id=46893 

When you run that, it installs the emulators for Hyper-V:

image

then, when you choose a Windows Phone 10 emulator, it will either start – or create, then start a Windows 10 emulator in Hyper-V:

image

Bottom Line:
This post is all about the Windows Phone emulator because everything else “just worked”. I only had an issue with these emulators. So, as of now, using Apache Cordova from within Visual Studio, I can successfully build and run on these emulators:

  • Windows Store
  • Windows Phone 8.x
  • Windows Phone 10
  • (Ripple) Android (phone and tablet)
  • (Ripple) iPhone
  • (Ripple) iPad

Now that I have the basics going, time to figure out how to build and package for each platform!

Posted in Computers and Internet, Development Tools, General, Mobile, New Technology, Professional Development, Uncategorized, Visual Studio, Windows Store, WindowsPhone

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Archives
Categories

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 2 other followers

%d bloggers like this: