convert-blazor-server-to-webapp
Guides conversion of a pre-.NET 8 Blazor Server app into a .NET 8+ Blazor Web App.
Skill by SteffenCarlsen
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/steffencarlsen-convert-blazor-server-to-webapp
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: frontend, backend
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/convert-blazor-server-to-webapp
What's inside
- Skill name
convert-blazor-server-to-webapp- Description
- Guides conversion of a pre-.NET 8 Blazor Server app into a .NET 8+ Blazor Web App. USE FOR: migrating apps that use AddServerSideBlazor and MapBlazorHub to the AddRazorComponents/MapRazorComponents model, converting _Host.cshtml to an App.razor root component, replacing blazor.server.js with blazor.web.js, migrating CascadingAuthenticationState to a service, adopting new Blazor Web App features like enhanced navigation and streaming rendering. DO NOT USE FOR: apps that are already Blazor Web Apps (already use AddRazorComponents and MapRazorComponents), Blazor WebAssembly or hosted Blazor WebAssembly apps (different migration path), apps that should stay on the Blazor Server hosting model without converting, or apps still targeting .NET Framework.
- License
- MIT
- Instructions
- 281 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Convert Blazor Server App to Blazor Web App
This skill helps an agent convert a pre-.NET 8 Blazor Server app into a .NET 8+ Blazor Web App. The old hosting model uses `AddServerSideBlazor`/`MapBlazorHub` with a `_Host.cshtml` Razor Page as the entry point. The new Blazor Web App model uses `AddRazorComponents`/`MapRazorComponents` with an `App.razor` root component, enabling per-component render modes, enhanced navigation, streaming rendering, and other .NET 8+ features. The converted app uses `InteractiveServer` render mode to preserve existing interactive behavior.
## When to Use
- Migrating a Blazor Server app from .NET 6 or .NET 7 to .NET 8+
- App currently uses `AddServerSideBlazor()` and `MapBlazorHub()` in `Program.cs` (or `Startup.cs`)
- App uses `Pages/_Host.cshtml` (or `_Host.razor`) as the host page with Component Tag Helpers
- Want to adopt new Blazor Web App features while keeping interactive server rendering
## When Not to Use
- **The app already uses `AddRazorComponents` and `MapRazorComponents`.** It is already a Blazor Web App — no conversion is needed. Stop here and tell the user the app is already using the Blazor Web App model.
- Blazor WebAssembly or hosted Blazor WebAssembly app — these have a different migration path
- The app should stay on the legacy Blazor Server hosting model (just update TFM and packages)
- The app targets .NET Framework — it must be migrated to .NET first
## Inputs
| Input | Required | Description |
|-------|----------|-------------|
| Blazor Server project | Yes | The `.csproj` and source files of the Blazor Server app |
| Target framework | Yes | .NET 8 or later (e.g., `net8.0`, `net9.0`, `net10.0`) |
| `Program.cs` or `Startup.cs` | Yes | The app's service and middleware configuration |
| `_Host.cshtml` location | Recommended | Usually `Pages/_Host.cshtml`; may be `_Host.razor` in some projects |
## Workflow
> **Commit strategy:** Commit after each logical step so the migration is reviewable and bisectable.
### Step 1: Update the project file
Update the `.csproj` file:
1. Change the Target Framework Moniker (TFM) to the target version:
```xml
<TargetFramework>net8.0</TargetFramework>
```
2. Update all `Microsoft.AspNetCore.*`, `Microsoft.EntityFrameworkCore.*`, `Microsoft.Extensions.*`, and `System.Net.Http.Json` package references to the matching version.
For non-Blazor project file changes (nullable reference types, implicit usings, HTTP/3 support, etc.), see the [general ASP.NET Core migration guide](https://learn.microsoft.com/aspnet/core/migration/70-to-80).
### Step 2: Create `Routes.razor` from `App.razor`
The old `App.razor` contains the `<Router>` component. This content moves to a new `Routes.razor` file so that `App.razor` can become the root HTML document component.
1. Create a new file `Routes.razor` in the project root.
2. Move the entire content of `App.razor` into `Routes.razor`.
3. If the content is wrapped in `<CascadingAuthenticationState>`, remove that wrapper (it will be replaced by a service in Step 5).
4. Leave `App.razor` empty for the next step.
The resulting `Routes.razor` should look similar to:
```razor
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found>
<NotFound>
<LayoutView Layout="@typeof(MainLayout)">
<p>Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
```
If the app uses `<AuthorizeRouteView>` instead of `<RouteView>`, keep it — it works the same way in Blazor Web Apps.
### Step 3: Convert `_Host.cshtml` to `App.razor`
Move the HTML shell from `Pages/_Host.cshtml` into the now-empty `App.razor` and transform it from a Razor Page into a Razor component:
1. **Remove Razor Page directives** — delete `@page "/"`, `@using Microsoft.AspNetCore.Components.Web`, `@namespace`, and `@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers`.
2. **Add component injection** — if using environment-conditional error UI, add:
```razor
@inject IHostEnvironment Env
```
3. **Fix the base tag** — replace `<base href="~/" />` with `<base href="/" />`.
4. **Replace HeadOutlet Component Tag Helper** — replace:
```html
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
```
with:
```razor
<HeadOutlet @rendermode="InteractiveServer" />
```
5. **Replace App Component Tag Helper with Routes** — replace:
```html
<component type="typeof(App)" render-mode="ServerPrerendered" />
```
with:
```razor
<Routes @rendermode="InteractiveServer" />
```
6. **Replace Environment Tag Helpers** — replace:
```html
<environment include="Staging,Production">
An error has occurred. This application may no longer respond until reloaded.
</environment>
<environment include="Development">
An unhandled exception has occurred. See browser dev tools for details.
</environment>
```
with:
```razor
@if (Env.IsDevelopment())
{
<text>
An unhandled exception has occurred. See browser dev tools for details.
</text>
}
elseFrom SteffenCarlsen/agent-skills, MIT.
More from SteffenCarlsen/agent-skills
- 0.524score
code-testing-agent
SteffenCarlsen
Generates and writes new unit tests for any programming language using a Research-Plan-Implement pipeline.
SkillBFreshness: BClaude Code +9 - 0.479score
android-tombstone-symbolication
SteffenCarlsen
Symbolicate the .NET runtime frames in an Android tombstone file.
SkillCFreshness: CClaude Code +9 - 0.479score
convert-to-cpm
SteffenCarlsen
Convert .NET projects and solutions (.sln, .slnx) to NuGet Central Package Management (CPM) using Directory.Packages.props.
SkillCFreshness: CClaude Code +9 - 0.479score
author-component
SteffenCarlsen
Create or review Blazor components (.razor files) with correct architecture.
SkillCFreshness: CClaude Code +9 - 0.479score
clr-activation-debugging
SteffenCarlsen
Diagnoses .NET Framework CLR activation issues using CLR activation logs (CLRLoad logs) produced by mscoree.dll.
SkillCFreshness: CClaude Code +9 - 0.479score
apple-crash-symbolication
SteffenCarlsen
Symbolicate .NET runtime frames in Apple platform .ips crash logs (iOS, tvOS, Mac Catalyst, macOS).
SkillCFreshness: CClaude Code +9 - 0.474score
configure-auth
SteffenCarlsen
Add authentication and authorization to a Blazor Web App, accounting for the app's render mode.
SkillCFreshness: CClaude Code +9 - 0.474score
build-parallelism
SteffenCarlsen
Guide for optimizing MSBuild build parallelism and multi-project scheduling.
SkillCFreshness: CClaude Code +9 - 0.474score
build-perf-baseline
SteffenCarlsen
Establish build performance baselines and apply systematic optimization techniques.
SkillCFreshness: CClaude Code +9 - 0.474score
build-perf-diagnostics
SteffenCarlsen
Diagnose MSBuild build performance bottlenecks using binary log analysis.
SkillCFreshness: CClaude Code +9 - 0.474score
check-bin-obj-clash
SteffenCarlsen
Detects MSBuild projects with conflicting OutputPath or IntermediateOutputPath.
SkillCFreshness: CClaude Code +9 - 0.474score
binlog-failure-analysis
SteffenCarlsen
Analyze MSBuild binary logs to diagnose build failures.
SkillCFreshness: CClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Jul 15, 2026 (3 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/SteffenCarlsen/agent-skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from SteffenCarlsen
- 0.524score
code-testing-agent
SteffenCarlsen
Generates and writes new unit tests for any programming language using a Research-Plan-Implement pipeline.
SkillBFreshness: BClaude Code +9 - 0.479score
apple-crash-symbolication
SteffenCarlsen
Symbolicate .NET runtime frames in Apple platform .ips crash logs (iOS, tvOS, Mac Catalyst, macOS).
SkillCFreshness: CClaude Code +9 - 0.479score
clr-activation-debugging
SteffenCarlsen
Diagnoses .NET Framework CLR activation issues using CLR activation logs (CLRLoad logs) produced by mscoree.dll.
SkillCFreshness: CClaude Code +9 - 0.479score
author-component
SteffenCarlsen
Create or review Blazor components (.razor files) with correct architecture.
SkillCFreshness: CClaude Code +9 - 0.479score
android-tombstone-symbolication
SteffenCarlsen
Symbolicate the .NET runtime frames in an Android tombstone file.
SkillCFreshness: CClaude Code +9 - 0.479score
convert-to-cpm
SteffenCarlsen
Convert .NET projects and solutions (.sln, .slnx) to NuGet Central Package Management (CPM) using Directory.Packages.props.
SkillCFreshness: CClaude Code +9
Cite this page
convert-blazor-server-to-webapp skill. Agent Mart. https://agentmart.dev/skills/steffencarlsen-convert-blazor-server-to-webapp (last updated 2026-10-24)