Migrate to .NET 9
ProprietaryMigrate C# projects to .NET 9, applying necessary API changes. Includes all .NET 7 and .NET 8 migration steps. See https://learn.microsoft.com/en-us/dotnet/core/compatibility/9.0.
OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net9. UpgradeToDotNet9mod run . --recipe= OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net9. UpgradeToDotNet9Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.
Recipe list
It runs these recipes, in this order.
- Migrate to .NET 8
- Change .NET target framework
- Upgrade NuGet package version
- Upgrade NuGet package version
- Upgrade NuGet package version
- Upgrade NuGet package version
- Upgrade NuGet package version
- Ensure csproj attestation
- Use Volatile.Read/Write (SYSLIB0054)
- Use X509CertificateLoader (SYSLIB0057)
- Use MapStaticAssets()
- Delete method argument
- Find LINQ ambiguities introduced by .NET 9
IAsyncEnumerableextensions - Find
AuthenticationManagerusage (SYSLIB0009) - Find
BinaryFormatterusage (removed in .NET 9) - Find
BinaryReader.ReadStringbehavior change - Find
EnumConverterconstructor validation change - Find
HttpListenerRequest.UserAgentnullable change - Find
InMemoryDirectoryInforootDir prepend change - Find
IncrementingPollingCounterasync callback change - Find
JsonSerializer.DeserializenullableJsonDocumentchange - Find
RuntimeHelpers.GetSubArrayreturn type change - Find
SafeEvpPKeyHandle.DuplicateHandleup-ref change - Find
ServicePointManagerusage (SYSLIB0014) - Find obsolete
X509Certificate2/X509Certificateconstructors (SYSLIB0057) - Find
ZipArchive.CreateEntrywithCompressionLevel(bit flag change) - Find
ZipArchiveEntryname/comment UTF-8 encoding change - Find
HttpClientHandlerusage (HttpClientFactory default change) - Find synchronous ExecuteUpdate/ExecuteDelete (EF Core 9)
- Find Swashbuckle usage (ASP.NET Core 9 built-in OpenAPI)
- Migrate Swashbuckle to built-in OpenAPI
- Find implicit authentication default scheme (ASP.NET Core 9)
- Use LINQ CountBy()
- Use Task.CompletedTask
- Remove ConfigureAwait(false)
- Use System.Threading.Lock for lock fields
- Use LINQ AggregateBy()
- Use LINQ Index()
- Use Frozen collections instead of Immutable
- Use \e escape sequence
- Find non-generic JsonStringEnumConverter
- Find IDistributedCache usage (HybridCache in .NET 9)