Skip to content

danroth27/Net8BlazorServer

Repository files navigation

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published