convert-blazor-server-to-webapp

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

1|Updated Jul 27, 2026
One-click install
npx skills add https://github.com/FittyAr/Cardscape --skill convert-blazor-server-to-webapp-fittyar
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: convert-blazor-server-to-webapp
Source: https://github.com/FittyAr/Cardscape/tree/main/.agents/skills/convert-blazor-server-to-webapp
Command: npx skills add https://github.com/FittyAr/Cardscape --skill convert-blazor-server-to-webapp-fittyar

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Migrating a legacy Blazor Server application to the modern .NET 8+ Blazor Web App model involves many coordinated, error-prone changes across the project file, Program.cs, _Host.cshtml, and App.razor. This Skill guides an agent through each step so nothing is missed, such as antiforgery middleware, script replacement, or authentication state migration. ## Core Features & Use Cases - Step-by-step migration workflow: Converts AddServerSideBlazor/MapBlazorHub to AddRazorComponents/MapRazorComponents, transforms _Host.cshtml into an App.razor root component, and moves the router into Routes.razor. - Pitfall detection and validation: Provides a checklist to verify no stale references remain (blazor.server.js, MapFallbackToPage, _Host.cshtml) and a table of common pitfalls like missing UseAntiforgery or lost circuit options. - Use Case: You have a .NET 7 Blazor Server app using Pages/_Host.cshtml and CascadingAuthenticationState. The Skill walks the agent through updating the TFM, rebuilding the hosting model, replacing the authentication wrapper with AddCascadingAuthenticationState, and verifying the app builds and runs on .NET 8+. ## Quick Start Ask the agent to convert this Blazor Server project to a .NET 8 Blazor Web App and verify no legacy hosting references remain.

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 migrate a Blazor Server app to .NET 8 Blazor Web App?▼

Update the TFM to net8.0 or later, 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().

How to replace _Host.cshtml in a Blazor Web App?▼

Move the HTML shell from Pages/_Host.cshtml into App.razor, remove Razor Page directives and Tag Helpers, replace the Component Tag Helpers with HeadOutlet and Routes components using InteractiveServer render mode, then delete _Host.cshtml.

Does Blazor Web App still use blazor.server.js?▼

No. Blazor Web Apps use _framework/blazor.web.js instead of _framework/blazor.server.js. All script references must be updated, since the old script does not work with the new hosting model.

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

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

When should I not convert a Blazor Server app to Blazor Web App?▼

Skip conversion if the app already uses AddRazorComponents and MapRazorComponents, if it is a Blazor WebAssembly app with a different migration path, if it must stay on the legacy Blazor Server model, or if it still targets .NET Framework.

How do I migrate CascadingAuthenticationState in Blazor Web Apps?▼

Remove the CascadingAuthenticationState component wrapper around the router and register builder.Services.AddCascadingAuthenticationState() in Program.cs. The component wrapper does not work across render mode boundaries in Blazor Web Apps.