convert-blazor-server-to-webapp

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

Updated Aug 9, 2026
One-click install
npx skills add https://github.com/adinj00/player-performance --skill convert-blazor-server-to-webapp-adinj00
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: convert-blazor-server-to-webapp
Source: https://github.com/adinj00/player-performance/tree/main/.agents/skills/convert-blazor-server-to-webapp
Command: npx skills add https://github.com/adinj00/player-performance --skill convert-blazor-server-to-webapp-adinj00

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 changes across the project file, Program.cs, _Host.cshtml, and App.razor, and missing any step causes build failures or runtime errors like broken form posts and lost authentication state. ## Core Features & Use Cases - Guided step-by-step migration: Converts AddServerSideBlazor/MapBlazorHub to AddRazorComponents/MapRazorComponents, transforms _Host.cshtml into an App.razor root component, and moves the Router into Routes.razor. - Edge-case handling: Covers prerendering preservation, circuit option migration, antiforgery middleware placement, and replacing CascadingAuthenticationState with the AddCascadingAuthenticationState service. - Validation checklist: Provides a concrete checklist and common pitfalls table to verify the migration, such as confirming no references to blazor.server.js or MapFallbackToPage remain. - Use Case: You have a .NET 7 Blazor Server app using Pages/_Host.cshtml and want to upgrade to .NET 8 with InteractiveServer render mode while keeping existing interactive behavior. ## Quick Start Ask the agent to convert this Blazor Server project to a .NET 8 Blazor Web App and follow the migration workflow step by step.

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, replace AddServerSideBlazor with AddRazorComponents().AddInteractiveServerComponents(), replace MapBlazorHub with MapRazorComponents<App>().AddInteractiveServerRenderMode(), move the Router from App.razor into Routes.razor, and transform _Host.cshtml into an App.razor root component.

How to migrate _Host.cshtml to App.razor in Blazor?

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 @rendermode="InteractiveServer" /> and <Routes @rendermode="InteractiveServer" />, change blazor.server.js to blazor.web.js, then delete _Host.cshtml.

Why do Blazor form posts return 400 errors after migrating to .NET 8?

The antiforgery middleware is missing from the pipeline. AddRazorComponents registers antiforgery services automatically, but you must explicitly add app.UseAntiforgery() after UseAuthentication and UseAuthorization, otherwise form POST requests fail with 400 errors.

Does CascadingAuthenticationState work in Blazor Web Apps?

The <CascadingAuthenticationState> component wrapper does not work across render mode boundaries in Blazor Web Apps. Replace it with builder.Services.AddCascadingAuthenticationState() in Program.cs, which provides the authentication state as a cascading value to all components.

When should I not convert a Blazor Server app to a 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 should remain on the legacy Blazor Server hosting model, or if it still targets .NET Framework.