Search⌘ K
AI Features

Empty Blazor Server Template

Explore the structure of the Empty Blazor Server template to understand its minimal setup, key files like Program.cs and App.razor, and how it provides the essential components for starting a Blazor Server app. This lesson helps you grasp the core dependencies and layout needed to build a Blazor Server application from scratch.

We'll cover the following...

The Blazor Server Empty project template provides only the essential components required for building a Blazor Server application. An example of this template is provided in the code widget below.

<Router AppAssembly="@typeof(App).Assembly">
    <Found Context="routeData">
        <RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
        <FocusOnNavigate RouteData="@routeData" Selector="h1" />
    </Found>
    <NotFound>
        <PageTitle>Not found</PageTitle>
        <LayoutView Layout="@typeof(MainLayout)">
            <p role="alert">Sorry, there's nothing at this address.</p>
        </LayoutView>
    </NotFound>
</Router>
Empty Blazor Server project setup

The essential Blazor Server components

If we look at the application entry point ...