convert-blazor-server-to-webapp

Converts pre-.NET 8 Blazor Server apps to the .NET 8+ Blazor Web App model.

Updated Jul 12, 2026
One-click install
npx skills add https://github.com/Patrick-Rex/DotNetTechSamples --skill convert-blazor-server-to-webapp-patrick-rex
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: convert-blazor-server-to-webapp
Source: https://github.com/Patrick-Rex/DotNetTechSamples/tree/main/.agents/plugins/dotnet-aspnetcore/skills/convert-blazor-server-to-webapp
Command: npx skills add https://github.com/Patrick-Rex/DotNetTechSamples --skill convert-blazor-server-to-webapp-patrick-rex

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Migrating a legacy Blazor Server application to .NET 8+ requires coordinated changes across the project file, Program.cs, _Host.cshtml, and App.razor, and missing any step (like antiforgery middleware or the blazor.web.js script) causes runtime failures that are hard to diagnose. ## Core Features & Use Cases - Guided step-by-step migration: Walks through updating the TFM, creating Routes.razor, converting _Host.cshtml into an App.razor root component, and replacing AddServerSideBlazor/MapBlazorHub with AddRazorComponents/MapRazorComponents. - Authentication and render mode handling: Migrates CascadingAuthenticationState to the AddCascadingAuthenticationState service and preserves prerendering behavior with InteractiveServerRenderMode options. - Validation checklist and pitfalls: Provides a verification checklist and a table of common pitfalls such as missing UseAntiforgery, leftover blazor.server.js references, and lost circuit options. - Use Case: You have a .NET 7 Blazor Server app using Pages/_Host.cshtml and want to move it to .NET 8 with streaming rendering and enhanced navigation while keeping interactive server rendering. ## Quick Start Ask the agent to convert your Blazor Server project to a Blazor Web App targeting net8.0 and follow the guided migration steps.

Frequently Asked Questions about convert-blazor-server-to-webapp

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert a Blazor Server app to a Blazor Web App in .NET 8?

Update the TFM to net8.0, move the Router from App.razor into a new Routes.razor, convert Pages/_Host.cshtml into an App.razor root component, and replace AddServerSideBlazor/MapBlazorHub with AddRazorComponents().AddInteractiveServerComponents() and MapRazorComponents<App>().AddInteractiveServerRenderMode().

What replaces AddServerSideBlazor and MapBlazorHub in .NET 8?

AddServerSideBlazor is replaced by AddRazorComponents().AddInteractiveServerComponents(), and MapBlazorHub is replaced by MapRazorComponents<App>().AddInteractiveServerRenderMode(). Circuit options like DetailedErrors migrate into the AddInteractiveServerComponents options delegate.

Why do form POST requests return 400 errors after migrating to Blazor Web App?

The antiforgery middleware is missing. AddRazorComponents registers antiforgery services automatically, but you must explicitly add app.UseAntiforgery() to the pipeline after UseAuthentication and UseAuthorization.

Does this migration work for Blazor WebAssembly apps?

No. Blazor WebAssembly and hosted Blazor WebAssembly apps follow a different migration path. This workflow only applies to apps using AddServerSideBlazor and MapBlazorHub with a _Host.cshtml entry point.

How do I keep prerendering disabled when migrating to InteractiveServer render mode?

If the original app used render-mode="Server" instead of "ServerPrerendered", use new InteractiveServerRenderMode(prerender: false) for both HeadOutlet and Routes instead of the default InteractiveServer, which enables prerendering.

Why does CascadingAuthenticationState stop working in a Blazor Web App?

The component wrapper does not propagate across render mode boundaries in Blazor Web Apps. Remove the wrapper and register builder.Services.AddCascadingAuthenticationState() so the authentication state flows to all components as a cascading value.