Blazor blazes onto mobile
Its always nice to receive a new gift over the Christmas break, summer here in Australia.
Over the last 2 years, we've been working closely with a new technology from Microsoft called Blazor. Blazor enables us to write the next generation of web applications using dotnet core and web assembly.
The beauty of this is a comprehensive and easily managed code base, consistent build and release tooling and an increase in management and performance (and in some ways a reduction in technical debt).
This week I've had my first tentative steps into Experimental Blazor Mobile Bindings - an experimental framework that allows us to bring blazor into the world of Android and iOS. Not having much apple (many apples?), I decided to build an application for Android.
First I added the blazor mobile bindings from a command line:
dotnet new -i Microsoft.MobileBlazorBindings.Templates::0.1.173-beta
Then I created a new application:
dotnet new mobileblazorbindings -o MyApp
Finally, after much messing about to get Android Emulators installed (see below), I was able to run a native Android Application on my physical phone and all I wrote was some blazor.
This simple application was simply written in Blazor (and any blazor person who has compiled the sample app, will have seen this strange version of the counter), but it compiles and installs as a native Android application.
On my phone, it starts immediately, runs perfectly and is super impressive.
However its super simple. They have some samples, but next I want to experiment with getting SQLLite working on the Mobile phone platform.
Next also is to get it working on iOS. I need some kit to do that, or use a cloud service so that is a work in progress.
Configuring your Development Environment
Here's the simple steps to get your development environment ready for this:
Install the very latest Visual Studio 2019
Add dotnet core and Xamarin Development
Add Windows Hypervisor
Add an Android Image
On your device go settings --> About this phone and tap a lot on the build number
Enable debug over USB and connect to your PC running VS
You can now deploy and debug on a phone
This is super tech, a single code base (almost) across Mobile and Web is a cool cross-platform experience and I look forward to see how it pans out...