← All recipes
Moderne licensed

Retarget to .NET Framework 4.8

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

Retargets a .NET Framework project to 4.8, the recommended modern target. Applies every intermediate minor-version step in order (4.0 -> 4.5 -> 4.5.1 -> 4.5.2 -> 4.6 -> 4.6.1 -> 4.6.2 -> 4.7 -> 4.7.1 -> 4.7.2 -> 4.8), updating <TargetFrameworkVersion> and <TargetFramework> in legacy and SDK-style csproj files, the <supportedRuntime sku> in app.config, and the targetFramework attribute in web.config at each step, and flagging affected source for review. Notable retargeting changes when reaching 4.8: managed crypto classes no longer throw in FIPS mode (Switch.System.Security.Cryptography.UseLegacyFipsThrow=true to revert); a third wave of accessibility improvements applies (keep legacy with all of Switch.UseLegacyAccessibilityFeatures, .2, and .3); HwndHost resizes correctly under per-monitor DPI; several WF/WPF checksum/hash defaults move to SHA-256. See https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/retargeting/4.8.x.

Composite recipecsharpdotnetnet-frameworkmigrationnet48Proprietary

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.UpgradeToNetFramework48

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.