Loading...
Loading...
Migrate a .NET 8 project to .NET 9 and resolve all breaking changes. USE FOR: upgrading TargetFramework from net8.0 to net9.0, fixing build errors after updating the .NET 9 SDK, resolving behavioral changes in .NET 9 / C# 13 / ASP.NET Core 9 / EF Core 9, replacing BinaryFormatter (now always throws), resolving SYSLIB0054-SYSLIB0057, adapting to params span overload resolution, fixing C# 13 compiler changes, updating HttpClientFactory for SocketsHttpHandler, and resolving EF Core 9 migration/Cosmos DB changes. DO NOT USE FOR: .NET Framework migrations, upgrading from .NET 7 or earlier, greenfield .NET 9 projects, or cosmetic modernization unrelated to the upgrade.
npx skill4agent add dotnet/skills migrate-dotnet8-to-dotnet9net9.0TargetFrameworknet8.0net9.0BinaryFormatternet9.0net10.0migrate-dotnet9-to-dotnet10| Input | Required | Description |
|---|---|---|
| Project or solution path | Yes | The |
| Build command | No | How to build (e.g., |
| Test command | No | How to run tests (e.g., |
| Project type hints | No | Whether the project uses ASP.NET Core, EF Core, WinForms, WPF, containers, etc. Auto-detect from PackageReferences and SDK attributes if not provided |
Answer directly from the loaded reference documents. Do not search the filesystem or fetch web pages for breaking change information — the references contain the authoritative details. Focus on identifying which breaking changes apply and providing concrete fixes.Commit strategy: Commit at each logical boundary — after updating the TFM (Step 2), after resolving build errors (Step 3), after addressing behavioral changes (Step 4), and after updating infrastructure (Step 5). This keeps each commit focused and reviewable.
.sln.slnx.csprojdotnet --versionMicrosoft.NET.Sdk.WebMicrosoft.NET.Sdk.WindowsDesktop<UseWPF><UseWindowsForms>Microsoft.EntityFrameworkCore.*Microsoft.Extensions.HttpBinaryFormatterSystem.Text.Jsondotnet build --no-incrementalbinobjnet8.0.csprojDirectory.Build.props<TargetFramework>net8.0</TargetFramework><TargetFramework>net9.0</TargetFramework>net9.0<TargetFrameworks>net8.0Microsoft.Extensions.*Microsoft.AspNetCore.*Microsoft.EntityFrameworkCore.*Directory.Packages.propsdotnet restorenet9.0net8.0| If the project uses… | Load reference |
|---|---|
| Any .NET 9 project | |
| Any .NET 9 project | |
| Any .NET 9 project | |
| ASP.NET Core | |
| Entity Framework Core | |
| Cryptography APIs | |
| System.Text.Json, HttpClient, networking | |
| Windows Forms or WPF | |
| Docker containers, native interop | |
| Runtime configuration, deployment | |
paramsparams ReadOnlySpan<T>String.JoinString.ConcatPath.CombineTask.WhenAllExpressionreferences/core-libraries-dotnet8to9.mdStringValuesparams Span<T>StringValuesString.ConcatString.JoinPath.Combinereferences/core-libraries-dotnet8to9.mdSYSLIB0054Thread.VolatileReadVolatileWriteVolatile.ReadVolatile.WriteSYSLIB0057X509Certificate2X509CertificateX509CertificateLoaderSYSLIB0055SYSLIB0056references/core-libraries-dotnet8to9.mdInlineArray[InlineArray]record structstructreferences/csharp-compiler-dotnet8to9.mdunsafeunsafereferences/csharp-compiler-dotnet8to9.md[]references/csharp-compiler-dotnet8to9.mdString.Trim(params ReadOnlySpan<char>)ReadOnlySpan<char>TrimTrimStartTrimEndreferences/core-libraries-dotnet8to9.mdBinaryFormatterBinaryFormatterreferences/serialization-networking-dotnet8to9.mdHttpListenerRequest.UserAgentstring?references/serialization-networking-dotnet8to9.mdreferences/winforms-wpf-dotnet8to9.mdreferences/winforms-wpf-dotnet8to9.mdfloatdoublereferences/deployment-runtime-dotnet8to9.mdMigrate()MigrateAsync()DateTime.NowDateTime.UtcNowGuid.NewGuid()HasDatanew DateTime(2024, 1, 1, 0, 0, 0, DateTimeKind.Utc)references/efcore-dotnet8to9.mdMigrate()references/efcore-dotnet8to9.mdSocketsHttpHandlerHttpClientHandlerInvalidCastExceptionreferences/serialization-networking-dotnet8to9.mdTracereferences/serialization-networking-dotnet8to9.mdruntimeconfig.jsonreferences/deployment-runtime-dotnet8to9.mdValidateOnBuildValidateScopesHostBuilderreferences/aspnet-core-dotnet8to9.mdFromKeyedServicesAttributeInvalidOperationExceptionBigInteger(2^31) - 1JsonDocumentnullJsonDocumentJsonValueKind.NullnullSystem.Text.JsonZipArchiveEntryIncrementingPollingCounterInMemoryDirectoryInfoRuntimeHelpers.GetSubArrayPictureBoxHttpRequestExceptionWebExceptionStatusStripIMsoComponentSafeEvpPKeyHandle.DuplicateHandleHttpClientserver.portdotnet watchGetXmlNamespaceMapsHashtableStringRUN apt-get update && apt-get install -y zlib1g# Before
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
FROM mcr.microsoft.com/dotnet/aspnet:8.0
# After
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
FROM mcr.microsoft.com/dotnet/aspnet:9.0global.json{
"sdk": {
"version": "9.0.100",
"rollForward": "latestFeature"
}
}rollForward"disable""latestPatch""latestFeature"net9.0net8.0dotnet build--tl:offMSBUILDTERMINALLOGGER=offdotnet workloaddotnet build --no-incrementaldotnet testreferences/| Reference file | When to load |
|---|---|
| Always (C# 13 compiler breaking changes — InlineArray on records, iterator safe context, collection expression overloads) |
| Always (applies to all .NET 9 projects) |
| Always (SDK and build tooling changes) |
| Project uses ASP.NET Core |
| Project uses Entity Framework Core |
| Project uses System.Security.Cryptography or X.509 certificates |
| Project uses BinaryFormatter, System.Text.Json, HttpClient, or networking APIs |
| Project uses Windows Forms or WPF |
| Project uses Docker containers or native interop (P/Invoke) |
| Project uses runtime configuration, deployment, or has floating-point to integer conversions |