Microsoft announced the availability of Visual Studio 2017 RC. I thought I would download it and give it a try.
I am hoping to get some of the latest Xamarin bits running. However my machine is currently running just right, so I did not want to mess it it.
So I have a few requirements:
- DON’T change my current VS/Xamarin setup
- Don’t mess with Hyper-V (needed for Android Emulator for VS)
- Build and run Xamarin apps.
Now those 3 things seemed almost mutually exclusive. At first I thought, no problem. I’ll spin up a VM in Hyper-V. To my surprise you can not attach a physical USB device to a Hyper-V. What about an emulator. Well at first Google it seemed like you can’t run a Hyper-V emulator inside a Hyper-V. However I know it is possible in VMWare, so I kept looking and found that it just might work.
You need the following:
- Windows 10 Enterprise (only version that supports Hyper-V)
- You need your Virtual Machine to have at least 3 processors (1 for the host and 2 for the emulator)
- Enough RAM for both the Virtual Machine and the Emulator. I gave my VM4GB. 2GB For the Emulator and the rest for the VM.
- Dynamic Memory has to be disabled.
Now here is the magic souse. You have to enable processor virtualization on your VM. So open PowerShell and type:
|Set-VMProcessor –VMName <VMname> -ExposeVirtualizationExtensions $true|
Replace <VMName> with the actual name of your VM from Hyper-V Manager. With all these items set, I was able to provision my emulator and start testing.
But NOT so fast, we are using pre-release software. I thought I would use the safe path to get a quick test going. File –> New Project. Select a Xamarin Forms app and build. BOOOM! It does not work. The Default File –> New project does not build.
So far I only tested the Android project as I have to upgrade Xamarin on my Mac to be able to build the iOS project. (see requirement 1)
The issue turned out to be with installing nuget packages. VS was throwing a file not found exception for the Xamarin.Android.Support.v7.RecyclerView. When you try to manually add it, it told you it is incompatible with Xamarin.Android.Support.Design package. Even when they have the same version numbers.
The Fix: I had to uninstall all the packages from the Android project. When you add Xamarin.Forms back, all the other packages are reinstalled. After I cleaned the solution, I was able to build and run.
Now I am looking forward to try out the Forms Previewer!