How do I reference index.html from a razor library in a Maui Blazor app?

TimTim 1 Reputation point
2022-11-24T16:05:12.5+00:00

How do I reference index.html from a razor library in a Maui Blazor app?
Scenario:

  • Create a .net Maui Blazor app and a Razor Class Library.
  • Move the wwwroot folder and its content over to the Razor class library from the Maui Blazor app. (I want to have all my static files in one location, that way I only need to have one copy of each file, that I can then share with my MAUI Blazor app, and later a Blazor Server app)

How do I reference the index.html file, now located in the Razor class library, from the MAUI Blazor app?

Original code in the MAUI Blazor app

<BlazorWebView HostPage="wwwroot/index.html">...</BlazorWebView>  

New code

<BlazorWebView HostPage="INDEX.HTML FROM RAZOR CLASS LIBRARY WWWROOT??">...</BlazorWebView>  
Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,449 questions
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,053 questions
{count} votes