6

I watched this tutorial on how to create a .NET MAUI Blazor App

https://www.youtube.com/watch?v=bnoCU5XGBh4

However I have an existing Blazor Web Assembly app, what is the best recommended way to wrap it into a BlazorWebView? I have dug around for tutorials but as its fairly new there is not much content.

User101
  • 748
  • 2
  • 10
  • 29
  • Are you looking to migrate from blazor to .NET MAUI blazor hybrid? or you want to resue/share the pages, components and other static files between blazor and .NET MAUI blazor hybrid? – fingers10 Oct 24 '22 at 18:20
  • @fingers10 I'm looking to write a blazor web assembly app than reuse it as a android app – User101 Nov 06 '22 at 22:04
  • 1
    you can create a web assembly app and move the pages to common razor class library and reuse the same in MAUI and Blazor. Checkout the sample repo https://github.com/fingers10/BlazorHybrid – fingers10 Nov 07 '22 at 09:28

1 Answers1

7

Steps:

  1. Create a web assembly app
  2. Move the pages/components to common razor class library
  3. Create MAUI Blazor Hybrid Project
  4. Reuse the common razor class library in MAUI and Blazor.

Checkout the sample repo

fingers10
  • 6,675
  • 10
  • 49
  • 87
  • What do you do with the authentication that is happening in the blazor app? Does that need to change? – user3656651 Nov 13 '22 at 03:50
  • No need. Authentication will automatically redirect to your Identity Provider. – fingers10 Nov 13 '22 at 04:33
  • 1
    Worth noting that Web project in referenced repo is to demonstrate alternative deployment to MAUI. If you simply want Blazor in MAUI you only need Common (Razor library) and MAUI as a startup project. – Pawel Feb 23 '23 at 15:30
  • Great repo, has helped me a lot, but I've been hunting all day to get an Authentication principle to pass successfully to something like on the front pages – jamheadart Feb 24 '23 at 13:47
  • 1
    I'm planning to make a production app using MAUI Blazor Hybrid Project. Will post here if I'm able to solve Authentication issue. – fingers10 Feb 25 '23 at 14:10