- license
SKILL.md
Die Skill-Datei bleibt im Repository des Herausgebers.
Fügen Sie den kopierten Befehl in ein Terminal ein. Er installiert diese SKILL.md in dem jeweiligen Agenten.
npx skills add dotnet/skills --skill create-blazor-project -a cursor -yFügen Sie den kopierten Befehl in ein Terminal ein. Er installiert diese SKILL.md in dem jeweiligen Agenten.
npx skills add dotnet/skills --skill create-blazor-project -a claude-code -yFügen Sie den kopierten Befehl in ein Terminal ein. Er installiert diese SKILL.md in dem jeweiligen Agenten.
npx skills add dotnet/skills --skill create-blazor-project -a codex -yFügen Sie den kopierten Befehl in ein Terminal ein. Er installiert diese SKILL.md in dem jeweiligen Agenten.
npx skills add dotnet/skills --skill create-blazor-project -a grok -ySenden Sie die kopierte Nachricht in einem Grok Bot-Chat. Der Bot ruft diese SKILL.md von GitHub ab und fügt sie den Skills hinzu, die alle Ihre Bots gemeinsam nutzen.
Install this skill: https://github.com/dotnet/skills/tree/HEAD/plugins/dotnet-blazor/skills/create-blazor-projectVom Herausgeber
If the user's request doesn't make the following clear, ask before scaffolding:
Blazor render modes are a progression scale. Start at the simplest level that satisfies the requirements and only move up when there's a concrete reason.
Static SSR ──→ SSR + Enhanced Nav ──→ Interactive Server ──→ Interactive WebAssembly
simplest most complex
Default recommendation: Start with -int Server (per-page). It covers the vast majority of apps. Upgrade to global or WebAssembly only when a specific requirement demands it.
Auto mode means your component code runs on the server first, then in the browser on subsequent visits. This creates real constraints:
.Client project — same as WebAssembly.DbContext, no file system, no server-only services. All data access must go through HTTP APIs.Program.cs files must register matching services — the server and client DI containers must both provide implementations for any service an interactive component injects.HttpContext access, no browser-only APIs without RendererInfo guards..Client project, forces API-mediated data access, and downloads ~10MB to the browser on first visit.dotnet new blazor -o {AppName} -int None
No interactive runtime. Enhanced navigation enabled by default via blazor.web.js.
dotnet new blazor -o {AppName} -int Server
Pages are static by default. Add @rendermode InteractiveServer to components that need interactivity.
dotnet new blazor -o {AppName} -int Server -ai
All pages interactive via <Routes @rendermode="InteractiveServer" /> in App.razor.
dotnet new blazor -o {AppName} -int WebAssembly
Creates {AppName} (server) and {AppName}.Client (WebAssembly) projects. Interactive components must live in .Client.
dotnet new blazor -o {AppName} -int WebAssembly -ai
dotnet new blazor -o {AppName} -int Auto
dotnet new blazor -o {AppName} -int Auto -ai
Append -au Individual to any command above:
dotnet new blazor -o {AppName} -int Server -au Individual
-au Individual scaffolds ASP.NET Core Identity with SQLite (CLI) or SQL Server (Visual Studio). Identity pages are always static SSR — they do not use interactive render modes.
The blazor template only supports -au Individual. For organizational auth (Microsoft Entra ID, Azure AD B2C), scaffold with -au Individual first, then replace the Identity provider with Microsoft.Identity.Web / OIDC middleware and configure the tenant in appsettings.json.
{AppName}/
├── Components/
│ ├── App.razor # Root component — sets <HeadOutlet> and <Routes>
│ ├── Routes.razor # Wraps <Router> with route discovery
│ ├── Layout/
│ │ ├── MainLayout.razor # App shell with nav, header, footer
│ │ └── MainLayout.razor.css
│ └── Pages/
│ └── Home.razor # @page "/" — first page
├── Program.cs # Service registration and middleware
├── wwwroot/ # Static files (CSS, images)
└── {AppName}.csproj
{AppName}/ # Server project — hosts the app
├── Components/ # Server-only components (static SSR pages, layouts)
│ ├── App.razor
│ ├── Routes.razor
│ └── Layout/
├── Program.cs # Server Program.cs
└── {AppName}.Client/ # Client project — WebAssembly components
├── Pages/ # Interactive components go HERE
├── Program.cs # Client Program.cs
└── _Imports.razor
Rule: Components using InteractiveWebAssembly or InteractiveAuto must live in the .Client project. They can reference shared code but cannot reference server-only types (EF DbContext, server-side services).
The template generates the correct Program.cs for the chosen mode. Verify these registrations match your intent:
// Program.cs
builder.Services.AddRazorComponents();
// ...
app.MapRazorComponents<App>();
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents();
// ...
app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode();
// Server Program.cs
builder.Services.AddRazorComponents()
.AddInteractiveWebAssemblyComponents();
// ...
app.MapRazorComponents<App>()
.AddInteractiveWebAssemblyRenderMode()
.AddAdditionalAssemblies(typeof({AppName}.Client._Imports).Assembly);
// Client Program.cs
builder.Services.AddAuthorizationCore();
// Register HttpClient, other client-side services
After scaffolding, create an AGENTS.md file in the project root (next to the .csproj). For two-project setups, put it in the server project root.
Pick the matching template from assets/agents-md/ based on the chosen mode:
Copy the template contents into the project's AGENTS.md and replace every {AppName} with the actual project name. If auth was scaffolded (-au Individual), add an ## Authentication section noting that ASP.NET Core Identity is configured and that Identity pages under Components/Account/ are always static SSR — do not add @rendermode to them.
After scaffolding the project and creating AGENTS.md, continue implementing the features the user requested. Remove default template pages (Counter, Weather) and replace them with the actual application pages.
// Server Program.cs
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents()
.AddInteractiveWebAssemblyComponents();
// ...
app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode()
.AddInteractiveWebAssemblyRenderMode()
.AddAdditionalAssemblies(typeof({AppName}.Client._Imports).Assembly);
The difference between global and per-page interactivity is entirely in App.razor:
<!DOCTYPE html>
<html>
<head>
<HeadOutlet />
</head>
<body>
<Routes />
<script src="_framework/blazor.web.js"></script>
</body>
</html>
No @rendermode on <Routes> or <HeadOutlet>. Individual pages opt in.
<!DOCTYPE html>
<html>
<head>
<HeadOutlet @rendermode="InteractiveServer" />
</head>
<body>
<Routes @rendermode="InteractiveServer" />
<script src="_framework/blazor.web.js"></script>
</body>
</html>
Replace InteractiveServer with InteractiveWebAssembly or InteractiveAuto as appropriate.
dotnet builddotnet run (in the server project if two-project setup).razor file in Components/Pages/ (server project) or Pages/ (.Client project for WebAssembly components)dotnet new blazorwasm — that creates a standalone WebAssembly SPA without server-side rendering. Use the blazor template with -int WebAssembly instead.AddInteractiveServerComponents() to a project created with -int None and expect it to work — you also need the @rendermode directives and potentially App.razor changes. Re-scaffold if the mode needs to change fundamentally.>
---name: create-blazor-projectdescription: >---# plugins/dotnet-blazor/skills/create-blazor-project/SKILL.mdFAQ
Laden Sie plugins/dotnet-blazor/skills/create-blazor-project/SKILL.md vom Herausgeber herunter oder kopieren Sie den Pfad und öffnen Sie das Repository. PlugMCP listet den Skill und hostet die Datei nicht.
Der Herausgeber pflegt es unter https://github.com/dotnet/skills.
Claude, Cursor, Codex und Grok Build können eine SKILL.md lesen, die Sie aus dem Repository des Herausgebers hinzufügen. Grok Bot installiert sie, wenn Sie den Link zum GitHub-Ordner des Skills in einem Chat senden.