Aalexbit-codemod

dotnet-47-to-8-recipe

The multi-step migration recipe for .NET 4.7 (core) → .NET 8 (framework)

dotnetnet4.7net8recipemigrationframeworkcore
PRO
20 executions

Run locally

npx codemod dotnet-47-to-8-recipe

This is a Pro codemod. Preview changes and insights for free, no login or code sharing required. Applying changes and accessing insights requires a paid plan and sign in.Learn more

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.
Contact us to get access to this codemod bundle.

Steps

  1. dotnet-sdk-style-netfx — legacy .csproj → SDK-style.
  2. dotnet-packagereference-migratepackages.configPackageReference.
  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-appsettingsApp.config/Web.configappsettings.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

Local Workflow Variant

For local end-to-end testing against the workspace packages, use
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

Run the local chain against the real rdp-portal checkout with:

bash

A small smoke fixture lives under 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

which expands to:

bash

The workflow order keeps declaration migration before final cutover, then runs
post-cutover cleanup and desktop-specific bootstrap modernization.

Ready to contribute?

Build your own codemod and share it with the community.