dotnet-47-to-8-recipe
The multi-step migration recipe for .NET 4.7 (core) → .NET 8 (framework)
# dotnet-47-to-8-recipe
A workflow recipe that daisy-chains the .NET 4.7 → .NET 8 codemods.
For an example migration using this recipe, check out this [blog post](https://codemod.com/blog/dot-net-v4-to-v8).
Contact us to get access to this codemod bundle.
## Steps
1. `dotnet-sdk-style-netfx` — legacy `.csproj` → SDK-style.
2. `dotnet-packagereference-migrate` — `packages.config` → `PackageReference`.
3. `dotnet-lib-multitarget-net8` — add `net8.0` to eligible SDK-style project `TargetFrameworks`.
4. `dotnet-aspnetcore-endpoints` — Web API 2 controllers → ASP.NET Core.
5. `dotnet-portable-framework-apis` — replace framework-only APIs (HttpUtility → WebUtility, etc.).
6. `dotnet-efcore-port` — EF Core DbContext constructor scaffolding.
7. `dotnet-owin-host-to-minimalapi` — OWIN self-host (`WebApp.Start<Startup>`, `Microsoft.Owin.Testing`) → ASP.NET Core minimal API host and `WebApplicationFactory`.
8. `dotnet-appconfig-to-appsettings` — `App.config`/`Web.config` → `appsettings.json` (`appSettings` + `connectionStrings`), drop `<entityFramework>`, `<startup>`, and `<runtime>/<assemblyBinding>` sections that no longer apply on .NET 8.
9. `dotnet-net8-cutover` — collapse to `<TargetFramework>net8.0</TargetFramework>` / `net8.0-windows` and strip `#if NET8_0` branches.
10. `dotnet-framework-facade-cleanup` — remove framework-provided facade packages and bare framework references after cutover.
11. `dotnet-runtime-config-cleanup` — remove remaining framework-only `<startup>` / `<runtime>` config sections.
12. `dotnet-winforms-bootstrap-modernize` — replace legacy WinForms bootstrap calls with `ApplicationConfiguration.Initialize()`.
The published generic chain is ordered as: 1 → 2 → 3 → 4 → 5 → 6 → 7 → 8 → 9 → 10 → 11 → 12.
## Run
```bash
pnpm dlx codemod@latest workflow run -w . -t /path/to/repo --allow-dirty --no-interactive
```
## Local Workflow Variant
For local end-to-end testing against the workspace packages, use
[`workflow.local.yaml`](./workflow.local.yaml). It points at the local package
directories instead of registry package names, but it now carries the same
12-step chain as the published workflow.
Smoke test the local chain with:
```bash
npm run test:workflow:local
```
Run the local chain against the real `rdp-portal` checkout with:
```bash
npm run run:rdp-portal:local
```
A small smoke fixture lives under [`smoke/workflow-input/`](./smoke/workflow-input) that mirrors an OWIN/EF6 ApiHost shape (similar to `dot-net-4-demo`'s `DemoApp.Legacy.ApiHost`). To exercise every node in the chain against the fixture:
```bash
npm run test:workflow
```
which expands to:
```bash
pnpm dlx codemod@latest workflow run -w . -t ./smoke/workflow-input --allow-dirty --no-interactive
```
The workflow order keeps declaration migration before final cutover, then runs
post-cutover cleanup and desktop-specific bootstrap modernization.