Blazor WASM + Hosted ASP.NET coupling

Rish 1 Reputation point


I am planning to deploy the latest version of Blazor WASM + Hosted ASP.NET core project type to Azure in production.
It publishes fine and works as expected.

However, before deploying, I really want to understand how they are coupled together so that it publishes both the Server and Client projects correctly?
Where is this magic happening?
Unable to find it in the documentation.

Please guide on where to look.

Thank you

A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,497 questions
A set of technologies in the .NET Framework for building web applications and XML web services.
3,414 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. AgaveJoe 27,656 Reputation points

    The client project is a Class Library DLL in the Server project. The fallback is index.html which is the file that bootstraps the Blazor application. Deploy the server app and take a look at the wwwroot folder.

    0 comments No comments

  2. Zhi Lv - MSFT 32,106 Reputation points Microsoft Vendor

    Hi @Rish ,

    An core hosted Blazor Webassembly application (for example named MultipleBlazorApps) contain the following projects:

    MultipleBlazorApps.Client is a Blazor WebAssembly client app in the Client folder.
    MultipleBlazorApps.Server is an ASP.NET Core server app that serves Blazor WebAssembly apps) in the Server folder. Optionally, the server app can also serve pages or views, as a traditional Razor Pages or MVC app.
    MultipleBlazorApps.Shared is a shared resources project for the client and server projects in the Shared folder.

    If you check the project reference, you can see that the Client and Server project will add the Shared project reference. And the Server project also depends on the Client and Shared project. So, when publish the application, you should publish the Server project.

    More detail infromation, see Hosted deployment with multiple Blazor WebAssembly apps.

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,

    0 comments No comments