convert-blazor-server-to-webapp

仓库创建 2026年2月4日最近提交 18 小时前SkillHot 收录 20 天前
▸ 精选理由

聚焦托管模型与入口组件的替换,适合进行版本升级与迁移工程。

这个 Skill 做什么

把旧的 Blazor Server 应用迁移到 .NET 8+ 的 Blazor Web App 模型。

把旧的 Blazor Server 应用迁到 .NET 8+ 的 Web App 模型,适用于还在用 AddServerSideBlazor/MapBlazorHub 和 _Host.cshtml 的项目。会说明如何改用 AddRazorComponents/MapRazorComponents、把入口换成 App.razor、替换 blazor.server.js 为 blazor.web.js 并迁移认证状态等。迁移后能用到更细粒度的组件渲染、流式渲染和改进的导航体验。

▸ 展开 SKILL.md 英文原文

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.

开发编程Blazor迁移.NET8通用
4.8k
Stars
351
Forks
40
仓库内 Skill
+610
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/dotnet/skills/main/plugins/dotnet-aspnetcore/skills/convert-blazor-server-to-webapp/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/dotnet/skills/main/plugins/dotnet-aspnetcore/skills/convert-blazor-server-to-webapp/SKILL.md"
SKILL.MD 节选查看完整文件 ↗
# 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
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有