How can I run a MAUI Blazor App in a web browser? I've used the VS MAUI with Blazor sample project
-
1You don't. You run `Blazor` itself in a web browser - see [Blazor docs](https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor). The purpose of `Maui Blazor` is to allow you to re-use Blazor HTML/CSS/C# inside a Maui app (for mobile or desktop), so that you have *some* sharing between your web browser code, and your app code. – ToolmakerSteve May 20 '22 at 22:03
4 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.

- 1,824
- 1
- 16
- 22
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

- 999
- 3
- 10
- 20
After asking my question I did review possible answers that are already available. I found one that hit the nail on the head. My answer is NO - you cannot use XAML in a Blazor Web application. You can create a Native application with Blazor MAUI that runs on Windows and mixes Blazor/Razor pages that use html and css along with pages that use XAML and C#.

- 19
- 2
when u run maui blazor on windows it already open it on Edge Browser .. u can do print and inspect content

- 1,711
- 1
- 13
- 16