Search⌘ K

Hosted Blazor WebAssembly

Explore how to host a Blazor WebAssembly application inside a standard ASP.NET Core project by understanding the hosted project template, required project files, and middleware configuration. This lesson guides you through adding necessary references and setting the application entry point, enabling you to integrate Blazor WebAssembly as a component of your ASP.NET Core web app.

We can host a Blazor WebAssembly inside a standard ASP.NET Core application. We can use the Blazor WebAssembly ASP.NET Core Hosted project template as outlined in the code widget below. This template already contains the ASP.NET Core project that hosts the Blazor WebAssembly application. The points highlighted in this lesson will help you understand how to add a Blazor WebAssembly application to any other ASP.NET Core application as one of its components.

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net7.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
  </PropertyGroup>

  <ItemGroup>
    <SupportedPlatform Include="browser" />
  </ItemGroup>
</Project>
Hosted Blazor WebAssembly project setup

This is the default setup that ...