Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run MAUI Blazor App in a web browser?

How can I run a MAUI Blazor App in a web browser? I've used the VS MAUI with Blazor sample project

like image 259
Daniel Ross Avatar asked Dec 18 '25 16:12

Daniel Ross


2 Answers

When you first hear MAUI Blazor, it's easy to think "web app running in a desktop/mobile app." That's what I thought, and I'm sure that's what many others thought. It turns out MAUI Blazor is more along the lines of "native desktop/mobile app that was developed using Blazor/Razor syntax instead of XAML."

So the short answer is no, you can't run a MAUI Blazor app in a web browser.

Originally, there were basically two basic models for hosting Blazor, Blazor Server and Blazor WASM (Web Assembly). At the time of this post, MAUI Blazor uses a third kind of hosting model, Blazor Hybrid. Blazor Hybrid is a completely different hosting model. With Hybrid, you get access to native capabilities of the deivce. This means you need a different codebase for each target platform (Android, Apple, Windows, etc). Because your Hybrid codebase can target and rely upon platform-specific functionality, you can't just move MAUI Blazor to a web app.

If you design your app carefully, creating a Blazor Server or Blazor WASM app using your MAUI Blazor components shouldn't be too difficult. If you're really careful, you may need almost no code changes. But simply running MAUI Blazor in a web browser is not possible.

Relevant MSDN article on Blazor hosting models.

like image 104
Patrick Tucci Avatar answered Dec 21 '25 23:12

Patrick Tucci


I haven't tried MAUI yet, but isn't it the other way round. MAUI Blazor is supposed to allow you to use Blazor Components inside a MAUI app.

This basically gives you the Blazor Binding magic instead of the XAML Binding magic, while still giving you access to device specific functions (e.g. on Mobile you can check wether you have a network connection or GPS or whatever)

I might be wrong though

like image 38
Gilles Radrizzi Avatar answered Dec 21 '25 23:12

Gilles Radrizzi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!