The webforms-to-blazor CLI is a powerful command-line tool that automates the first phase of your Web Forms to Blazor migration. It performs deterministic, pattern-based transformations on your Web Forms markup and code-behind to produce Blazor-ready code and a .NET 10 Blazor Web App scaffold configured for static server-side rendering (SSR).
This tool reduces manual migration effort by:
- Removing boilerplate Web Forms directives and syntax
- Converting ASP.NET server controls to BWFC components
- Replacing Web Forms expressions with Blazor syntax
- Applying semantic page-pattern rewrites after the core transform pass
- Extracting code patterns and flagging them with TODO comments for Copilot L2 automation
- Quarantining risky legacy bootstrap/source artifacts out of the generated SSR compile surface
- Scaffolding a new .NET 10 Blazor SSR project structure with shims and services
The tool processes .aspx, .ascx, and .master files in a fixed sequence, then applies a bounded semantic pattern catalog so each higher-level rewrite builds on a normalized page shape.
dotnet tool install --global Fritz.WebFormsToBlazorcd src/BlazorWebFormsComponents.Cli
dotnet pack
dotnet tool install --global --add-source ./bin/Release Fritz.WebFormsToBlazorwebforms-to-blazor --helpwebforms-to-blazor convert --input ProductCard.ascx --output ./BlazorComponentswebforms-to-blazor migrate --input ./MyWebFormsProject --output ./MyBlazorProjectThe tool will:
- Scan all
.aspx,.ascx, and.masterfiles - Apply the ordered markup and code-behind transform pipeline
- Apply semantic page-pattern rewrites for known recurring Web Forms shapes
- Generate a migration report
- Scaffold supporting files for a .NET 10 Blazor SSR app (Program.cs, App.razor, shims, handlers)
Transforms an entire Web Forms project to .NET 10 Blazor SSR with scaffolding.
webforms-to-blazor migrate \
--input ./MyWebFormsProject \
--output ./MyBlazorProjectKey Options:
--input <path>— Web Forms project root (required)--output <path>— .NET 10 Blazor SSR output directory (required)--skip-scaffold— Skip generating the .NET 10 Blazor SSR scaffold--dry-run— Preview changes without writing files--verbose/-v— Show detailed per-file transform logging--overwrite— Overwrite existing files in the output directory--report <path>— Write the JSON migration report to a specific file
Output:
- Converted
.razorfiles - Quarantined manual code-behind and risky legacy source artifacts under
migration-artifacts\ - Generated
Program.cswith shim registration for static SSR on .NET 10 - Migration report (
migration-report.json)
Converts individual files without scaffolding. Useful for incremental migrations.
webforms-to-blazor convert \
--input ./Controls/MyControl.ascx \
--output ./Components/MyControl.razorKey Options:
--input <path>— Single.ascxor.aspxfile (required)--output <path>— Output file path--overwrite— Overwrite an existing generated file
The tool applies an ordered transform pipeline and then a semantic pattern catalog:
- Directives (5) — Page, Master, Control, Register, Import directives
- Markup (19) — Controls, expressions, templates, data binding
- Code-Behind (9) — Using statements, base classes, lifecycle, event handlers
See Transform Reference for the flat transform list and Semantic Pattern Catalog for the bounded semantic pass that runs afterward.
The tool inserts TODO comments with standardized category slugs so Copilot L2 skills can automatically follow up on migration work:
// TODO(bwfc-lifecycle): Page_Load → OnInitializedAsync
// TODO(bwfc-ispostback): Review IsPostBack guard for Blazor patterns
// TODO(bwfc-session-state): SessionShim auto-wired via [Inject]See TODO Categories for the complete list of 13 categories and how L2 automation uses them.
After migration, the tool generates a migration-report.json with:
- File-by-file transformation summary
- Manual work items flagged by category
- Severity levels (Info, Warning, Error)
- Precise file locations and line numbers
See Report Format for schema and examples.
This tool handles Level 1 transformations only:
- ✅ Markup and directive conversion
- ✅ Pattern detection and guidance
- ✅ Boilerplate removal
- ❌ Logic rewriting (use Copilot L2 skills for this)
After running the CLI:
- Review TODO comments — each one points to a specific migration pattern
- Run Copilot L2 skills — automated follow-up transforms for complex patterns
- Build and test — verify your Blazor project compiles and runs
- Manual tweaks — business logic, styling, third-party integrations
# 1. Scan and transform
webforms-to-blazor migrate \
--input ./MyApp.Web \
--output ./MyApp.Blazor
# 2. Review migration report
cat MyApp.Blazor/migration-report.json | jq '.manualItems[] | select(.severity == "Error")'
# 3. Build and identify missing pieces
cd MyApp.Blazor
dotnet build
# 4. Use Copilot CLI for L2 automation
copilot /webforms-migration- Transform Reference — See what each transform does with before/after examples
- Semantic Pattern Catalog — Understand when page-shape rewrites belong in the isolated semantic pass
- TODO Conventions — Understand the TODO categories for L2 automation
- Report Schema — Interpret the migration report
- Migration Strategies — Learn the full migration approach