Creating an app with Blazor and .NET MAUI

Creating an app with Blazor and .NET MAUI

As you probably heard, Microsoft announced another technology called .NET MAUI some time ago. It is a cross-platform framework for developing desktop and native mobile apps. This is quite a polarising topic, but I want not to focus on that today. Instead, I will show you how to build and run a .NET MAUI Blazor application.

Blazor Hybrid

First of all, let me explain what Blazor Hybrid is – an approach to building interactive client-side web UI with .NET in an ASP.NET Core app. In the Blazor Hybrid application, Razor components run natively on the device. The components are rendered to the embedded Web View control via a local inter-operator channel. The components do not run in the browser and WebAssembly is not involved. Razor components load and execute code quickly, and components have full access to the native capabilities of the device via the .NET platform, which is a significant benefit.

.NET MAUI

.NET MAUI is open source and is the next step after Xamarin.Forms. If you have previously used Xamarin to create cross-platform user interfaces, you will notice many similarities with .NET MAUI. However, there are also some differences. Using the .NET MAUI platform, you can create cross-platform applications using a single project and add platform-specific source code and resources as needed. That is the main goal of .NET MAUI – allowing as much of the application logic and user interface layout to be implemented as possible in a single code base.

Blazor Hybrid application with .NET MAUI

Blazor Hybrid support is built into the structure of .NET MAUI, which includes a BlazorWebView control that allows Razor components to be rendered into an embedded web view. Using both – .NET MAUI and Blazor platforms simultaneously, you can reuse a single set of web UI components across mobile, desktop and web. That sounds promising, right?

Creating a .NET MAUI Blazor application

Ok, so we can go to creating a .NET MAUI Blazor application. First of all, you need to install Visual Studio 2022 and create a new project. Of course, select the .NET MAUI Blazor App:

Then, set up basic things about your project and create that! 🙂

Before running a desktop version, make sure Developer Mode is enabled on your OS:

The app running as a Windows desktop app looks like this:

It looks good, right? 😉

As might be expected, you can install and configure emulators for Android or iOS:

Find out more details about this here.

I have no idea in which direction this framework will go but one thing is sure – Microsoft takes the development of this tool very seriously. In that case, it is probably worth reading and having a little fun. 😉

More about .NET MAUI coming soon…

1 Comment

  1. Thanks for the information! We all are aware of the cut-throat competition about the technologies in the market. But not everyone knows what exactly these technologies and languages are offering. I value your efforts to spread the word about it. Go on posting!

    Reply

Leave a Reply

Your email address will not be published.

Scroll to top