convert-blazor-server-to-webapp

Converts pre-.NET 8 Blazor Server apps into .NET 8+ Blazor Web Apps.

Updated Jul 20, 2026
One-click install
npx skills add https://github.com/Netcodr81/kinetic-reports --skill convert-blazor-server-to-webapp-netcodr81
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: convert-blazor-server-to-webapp
Source: https://github.com/Netcodr81/kinetic-reports/tree/main/.github/skills/convert-blazor-server-to-webapp
Command: npx skills add https://github.com/Netcodr81/kinetic-reports --skill convert-blazor-server-to-webapp-netcodr81

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Migrating a legacy Blazor Server app to the .NET 8+ Blazor Web App model involves many coordinated changes across Program.cs, _Host.cshtml, App.razor, and routing configuration, and missing any step causes build failures or runtime errors like antiforgery 400 responses. ## Core Features & Use Cases - Step-by-step migration workflow: Updates the project file, creates Routes.razor, converts _Host.cshtml into an App.razor root component, and rewrites Program.cs to use AddRazorComponents and MapRazorComponents. - Authentication migration: Replaces the CascadingAuthenticationState component wrapper with the AddCascadingAuthenticationState service so auth works across render mode boundaries. - Validation checklist and pitfalls: Provides a verification checklist and solutions for common issues like missing UseAntiforgery middleware, stale blazor.server.js references, and lost circuit options. - Use Case: You have a .NET 7 Blazor Server app using AddServerSideBlazor and MapBlazorHub and want to upgrade it to .NET 8 with InteractiveServer render mode while preserving existing behavior. ## Quick Start Convert my Blazor Server project in this repository to a .NET 8 Blazor Web App following the migration workflow.

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 target framework, 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() in Program.cs.

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

Move the HTML shell from _Host.cshtml into App.razor, remove Razor Page directives, replace Component Tag Helpers with HeadOutlet and Routes components using InteractiveServer render mode, change the base href to "/", swap blazor.server.js for blazor.web.js, then delete _Host.cshtml.

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

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

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 the service-based approach by calling builder.Services.AddCascadingAuthenticationState() in Program.cs.

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

Skip conversion if the app already uses AddRazorComponents and MapRazorComponents, is a Blazor WebAssembly app with a different migration path, targets .NET Framework, or should remain on the legacy Blazor Server hosting model with only TFM and package updates.