danroth27 / Net8BlazorServer

Blazor Server app with .NET 8

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Blazor Server in .NET 8

This project demonstrates how to upgrade Blazor Server apps to .NET 8 and take advantage of the latest Blazor features.

To upgrade an existing Blazor Server app to .NET 8:

  1. Update the project file to target net8.0 and package references to the latest .NET 8 versions.
  2. Move the contents of App.razor to Routes.razor.
  3. Move content from Pages/_Host.cshtml to App.razor:
    1. Update script to blazor.web.js.
    2. Replace tag helpers with Blazor equivalents.
  4. Update Program.cs:
    1. Replace AddServerSideBlazor() with AddRazorComponents().AddInteractiveServerComponents().
    2. Add app.UseAntiforgery().
    3. Replace MapBlazorHub() with MapRazorComponents<App>().AddInteractiveServerRenderMode().
    4. Remove app.MapFallbackToPage("/_Host");.

About

Blazor Server app with .NET 8

License:MIT License


Languages

Language:HTML 52.6%Language:CSS 32.6%Language:C# 14.8%