← All recipes
Moderne licensed

Retarget to .NET Framework 4.8.1

Recipe IDOpenRewrite.Recipes.CSharp.Migration.Dotnet.NetFramework.UpgradeToNetFramework481ArtifactOpenRewrite.Recipes.CSharp.Migration.Dotnet

Retargets a .NET Framework project to 4.8.1, applying the full 4.0 -> 4.8 chain and then bumping to 4.8.1. Updates <TargetFrameworkVersion> to v4.8.1, <TargetFramework> to net481, the app.config <supportedRuntime sku>, and the web.config targetFramework. .NET Framework 4.8.1 introduced no application-compatibility (retargeting) changes, so this step is purely the version bump. **Compatibility caveat:** 4.8.1 requires Windows 11 (21H2+) or Windows Server 2022+ at runtime and Visual Studio 2022 17.3+ to build, and is the only 4.x release with native Arm64 support. If any target machine runs Windows 10 or older Windows Server, stop at UpgradeToNetFramework48 instead. See https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/retargeting/4.8.x.

Composite recipecsharpdotnetnet-frameworkmigrationnet481Proprietary

Usage

This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.

mod run . --recipe OpenRewrite.Recipes.CSharp.Migration.Dotnet.NetFramework.UpgradeToNetFramework481

If the recipe isn’t available locally, install it with:

mod config recipes nuget install OpenRewrite.Recipes.CSharp.Migration.Dotnet

Definition

This recipe runs the following recipes in order.

  • Retarget to .NET Framework 4.8OpenRewrite.Recipes.CSharp.Migration.Dotnet.NetFramework.UpgradeToNetFramework48
  • Change .NET Framework versionOpenRewrite.CSharp.Recipes.ChangeDotNetFrameworkVersion
  • Change .NET target frameworkOpenRewrite.CSharp.Recipes.ChangeDotNetTargetFramework
  • Change web.config target frameworkOpenRewrite.CSharp.Recipes.ChangeWebConfigTargetFramework
  • Ensure csproj attestationOpenRewrite.CSharp.Recipes.EnsureCsprojAttestation