Migrate to .NET 8
Recipe ID
OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net8.UpgradeToDotNet8ArtifactOpenRewrite.Recipes.CSharp.Migration.DotnetMigrate C# projects to .NET 8, applying necessary API changes. Includes all .NET 7 migration steps. See https://learn.microsoft.com/en-us/dotnet/core/compatibility/8.0.
Composite recipecsharpdotnetmigrationProprietary
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.Net8.UpgradeToDotNet8If the recipe isn’t available locally, install it with:
mod config recipes nuget install OpenRewrite.Recipes.CSharp.Migration.DotnetDefinition
This recipe runs the following recipes in order.
- Migrate to .NET 7
OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net7.UpgradeToDotNet7 - Change .NET target framework
OpenRewrite.CSharp.Recipes.ChangeDotNetTargetFramework - Upgrade NuGet package version
OpenRewrite.CSharp.Recipes.UpgradeNuGetPackageVersion - Upgrade NuGet package version
OpenRewrite.CSharp.Recipes.UpgradeNuGetPackageVersion - Upgrade NuGet package version
OpenRewrite.CSharp.Recipes.UpgradeNuGetPackageVersion - Upgrade NuGet package version
OpenRewrite.CSharp.Recipes.UpgradeNuGetPackageVersion - Upgrade NuGet package version
OpenRewrite.CSharp.Recipes.UpgradeNuGetPackageVersion - Ensure csproj attestation
OpenRewrite.CSharp.Recipes.EnsureCsprojAttestation - Change method name
OpenRewrite.Recipes.CSharp.Migration.Dotnet.ChangeMethodName - Change method name
OpenRewrite.Recipes.CSharp.Migration.Dotnet.ChangeMethodName - Change method name
OpenRewrite.Recipes.CSharp.Migration.Dotnet.ChangeMethodName - Change method name
OpenRewrite.Recipes.CSharp.Migration.Dotnet.ChangeMethodName - Change type
OpenRewrite.Recipes.CSharp.Migration.Dotnet.ChangeType - Find legacy serialization constructors (SYSLIB0051)
OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net8.FindSerializationConstructors - Find
JsonSerializerOptions.AddContextusage (SYSLIB0049)OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net8.FindAddContext - Find formatter-based serialization types (SYSLIB0050/0051)
OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net8.FindFormatterBasedSerialization - Find
Regex.CompileToAssemblyusage (SYSLIB0052)OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net8.FindRegexCompileToAssembly - Find
AesGcmconstructor without tag size (SYSLIB0053)OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net8.FindAesGcmOldConstructor - Use ArgumentException.ThrowIfNullOrWhiteSpace()
OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net8.UseThrowIfNullOrWhiteSpace - Use ArgumentOutOfRangeException.ThrowIfGreaterThan()
OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net8.UseThrowIfGreaterThan - Use ArgumentOutOfRangeException.ThrowIfLessThan()
OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net8.UseThrowIfLessThan - Use ArgumentOutOfRangeException.ThrowIfZero()
OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net8.UseThrowIfZero - Find DateTime.Now/UtcNow usage (TimeProvider in .NET 8)
OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net8.FindTimeAbstraction - Find ToImmutable*() that could use Frozen collections
OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net8.FindFrozenCollection