migrate-dotnet8-to-dotnet9
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese.NET 8 → .NET 9 Migration
.NET 8 迁移至 .NET 9
Migrate a .NET 8 project or solution to .NET 9, systematically resolving all breaking changes. The outcome is a project targeting that builds cleanly, passes tests, and accounts for every behavioral, source-incompatible, and binary-incompatible change introduced in the .NET 9 release.
net9.0将 .NET 8 项目或解决方案迁移至 .NET 9,系统地解决所有重大变更问题。最终成果是一个以 为目标框架的项目,可正常构建、通过测试,并适配 .NET 9 版本中引入的所有行为、源代码不兼容和二进制不兼容变更。
net9.0When to Use
适用场景
- Upgrading from
TargetFrameworktonet8.0net9.0 - Resolving build errors or new warnings after updating the .NET 9 SDK
- Adapting to behavioral changes in .NET 9 runtime, ASP.NET Core 9, or EF Core 9
- Replacing usage (now always throws at runtime)
BinaryFormatter - Updating CI/CD pipelines, Dockerfiles, or deployment scripts for .NET 9
- 将 从
TargetFramework升级至net8.0net9.0 - 更新 .NET 9 SDK 后解决构建错误或新警告
- 适配 .NET 9 运行时、ASP.NET Core 9 或 EF Core 9 中的行为变更
- 替换 的使用(现在在运行时始终会抛出异常)
BinaryFormatter - 为 .NET 9 更新 CI/CD 流水线、Dockerfile 或部署脚本
When Not to Use
不适用场景
- The project already targets and builds cleanly — migration is done. If the goal is to reach
net9.0, use thenet10.0skill as the next step.migrate-dotnet9-to-dotnet10 - Upgrading from .NET 7 or earlier — address the prior version breaking changes first
- Migrating from .NET Framework — that is a separate, larger effort
- Greenfield projects that start on .NET 9 (no migration needed)
- 项目已以 为目标框架且可正常构建——迁移已完成。如果目标是升级至
net9.0,下一步请使用net10.0技能。migrate-dotnet9-to-dotnet10 - 从 .NET 7 或更早版本升级——请先处理旧版本的重大变更问题
- 从 .NET Framework 迁移——这是一项独立且更复杂的工作
- 全新的 .NET 9 项目(无需迁移)
Inputs
输入项
| 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 |
| 输入项 | 是否必填 | 描述 |
|---|---|---|
| 项目或解决方案路径 | 是 | 要迁移的 |
| 构建命令 | 否 | 构建方式(例如: |
| 测试命令 | 否 | 运行测试的方式(例如: |
| 项目类型提示 | 否 | 项目是否使用 ASP.NET Core、EF Core、WinForms、WPF、容器等。未提供时将通过 PackageReferences 和 SDK 属性自动检测 |
Workflow
工作流程
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.
直接从加载的参考文档中获取答案。请勿在文件系统中搜索或从网页获取重大变更信息——参考文档包含权威细节。重点识别哪些重大变更适用并提供具体修复方案。提交策略:在每个逻辑节点提交代码——更新 TFM(步骤2)后、解决构建错误(步骤3)后、处理行为变更(步骤4)后、更新基础设施(步骤5)后。这样可使每次提交的内容聚焦且便于评审。
Step 1: Assess the project
步骤1:评估项目
- Identify how the project is built and tested. Look for build scripts, /
.slnfiles, or individual.slnxfiles..csproj - Run to confirm the .NET 9 SDK is installed. If it is not, stop and inform the user.
dotnet --version - Determine which technology areas the project uses by examining:
- SDK attribute: → ASP.NET Core;
Microsoft.NET.Sdk.WebwithMicrosoft.NET.Sdk.WindowsDesktopor<UseWPF>→ WPF/WinForms<UseWindowsForms> - PackageReferences: → EF Core;
Microsoft.EntityFrameworkCore.*→ HttpClientFactoryMicrosoft.Extensions.Http - Dockerfile presence → Container changes relevant
- P/Invoke or native interop usage → Interop changes relevant
- usage → Serialization migration needed
BinaryFormatter - usage → Serialization changes relevant
System.Text.Json - X509Certificate constructors → Cryptography changes relevant
- SDK attribute:
- Record which reference documents are relevant (see the reference loading table in Step 3).
- Do a clean build (or delete
dotnet build --no-incremental/bin) on the currentobjtarget to establish a clean baseline. Record any pre-existing warnings.net8.0
- 确定项目的构建和测试方式。查找构建脚本、/
.sln文件或单个.slnx文件。.csproj - 运行 确认已安装 .NET 9 SDK。如果未安装,请停止操作并告知用户。
dotnet --version - 通过检查以下内容确定项目使用的技术领域:
- SDK 属性:→ ASP.NET Core;
Microsoft.NET.Sdk.Web搭配Microsoft.NET.Sdk.WindowsDesktop或<UseWPF>→ WPF/WinForms<UseWindowsForms> - PackageReferences:→ EF Core;
Microsoft.EntityFrameworkCore.*→ HttpClientFactoryMicrosoft.Extensions.Http - Dockerfile 存在性 → 需关注容器相关变更
- P/Invoke 或原生互操作使用情况 → 需关注互操作变更
- 使用情况 → 需要进行序列化迁移
BinaryFormatter - 使用情况 → 需关注序列化变更
System.Text.Json - X509Certificate 构造函数 → 需关注加密变更
- SDK 属性:
- 记录相关的参考文档(请参阅步骤3中的参考文档加载表)。
- 在当前 目标框架上执行清理构建(
net8.0或删除dotnet build --no-incremental/bin目录),建立干净的基线。记录所有预先存在的警告。obj
Step 2: Update the Target Framework
步骤2:更新目标框架
-
In each(or
.csprojif centralized), change:Directory.Build.propsxml<TargetFramework>net8.0</TargetFramework>to:xml<TargetFramework>net9.0</TargetFramework>For multi-targeted projects, addtonet9.0or replace<TargetFrameworks>.net8.0 -
Update all,
Microsoft.Extensions.*,Microsoft.AspNetCore.*, and other Microsoft package references to their 9.0.x versions. If using Central Package Management (Microsoft.EntityFrameworkCore.*), update versions there.Directory.Packages.props -
Run. Watch for:
dotnet restore- Version requirements: .NET 9 SDK requires Visual Studio 17.12+ to target (17.11 for
net9.0and earlier).net8.0 - New warnings for .NET Standard 1.x and .NET 7 targets — consider updating or removing outdated target frameworks.
- Version requirements: .NET 9 SDK requires Visual Studio 17.12+ to target
-
Run a clean build. Collect all errors and new warnings. These will be addressed in Step 3.
-
在每个文件(如果是集中管理则为
.csproj)中,将:Directory.Build.propsxml<TargetFramework>net8.0</TargetFramework>修改为:xml<TargetFramework>net9.0</TargetFramework>对于多目标框架项目,将添加至net9.0或替换<TargetFrameworks>。net8.0 -
将所有、
Microsoft.Extensions.*、Microsoft.AspNetCore.*及其他 Microsoft 包引用更新至 9.0.x 版本。如果使用集中包管理(Microsoft.EntityFrameworkCore.*),请在该文件中更新版本。Directory.Packages.props -
运行。注意:
dotnet restore- 版本要求:.NET 9 SDK 需要 Visual Studio 17.12+ 才能以 为目标框架(
net9.0及更早版本需要 17.11)。net8.0 - 针对 .NET Standard 1.x 和 .NET 7 目标框架的新警告——考虑更新或移除过时的目标框架。
- 版本要求:.NET 9 SDK 需要 Visual Studio 17.12+ 才能以
-
执行清理构建。收集所有错误和新警告,这些将在步骤3中处理。
Step 3: Resolve build errors and source-incompatible changes
步骤3:解决构建错误和源代码不兼容变更
Work through compilation errors and new warnings systematically. Load the appropriate reference documents based on the project type:
| 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 | |
Common source-incompatible changes to check for:
-
span overload resolution — New
paramsoverloads onparams ReadOnlySpan<T>,String.Join,String.Concat,Path.Combine, and many more now bind preferentially. Code calling these methods insideTask.WhenAlllambdas will fail (CS8640/CS9226). SeeExpression.references/core-libraries-dotnet8to9.md -
ambiguous overload — The
StringValuesfeature creates ambiguity withparams Span<T>implicit operators on methods likeStringValues,String.Concat,String.Join. Fix by explicitly casting arguments. SeePath.Combine.references/core-libraries-dotnet8to9.md -
New obsoletion warnings (SYSLIB0054–SYSLIB0057):
- : Replace
SYSLIB0054/Thread.VolatileReadwithVolatileWrite/Volatile.ReadVolatile.Write - : Replace
SYSLIB0057/X509Certificate2binary/file constructors withX509CertificatemethodsX509CertificateLoader - Also (ARM AdvSimd signed overloads) and
SYSLIB0055(Assembly.LoadFrom with hash algorithm) — seeSYSLIB0056references/core-libraries-dotnet8to9.md
-
C# 13on record structs —
InlineArrayattribute on[InlineArray]types is now disallowed (CS9259). Change to a regularrecord struct. Seestruct.references/csharp-compiler-dotnet8to9.md -
C# 13 iterator safe context — Iterators now introduce a safe context in C# 13. Local functions inside iterators that used unsafe code inherited from an outerclass will now error. Add
unsafemodifier to the local function. Seeunsafe.references/csharp-compiler-dotnet8to9.md -
C# 13 collection expression overload resolution — Empty collection expressions () no longer use span vs non-span to tiebreak overloads. Exact element type is now preferred. See
[].references/csharp-compiler-dotnet8to9.md -
removed — Code compiled against .NET 9 previews that passes
String.Trim(params ReadOnlySpan<char>)toReadOnlySpan<char>/Trim/TrimStartmust rebuild; the overload was removed in GA. SeeTrimEnd.references/core-libraries-dotnet8to9.md -
always throws — If the project uses
BinaryFormatter, stop and inform the user — this is a major decision. SeeBinaryFormatter.references/serialization-networking-dotnet8to9.md -
is nullable — The property is now
HttpListenerRequest.UserAgent. Add null checks. Seestring?.references/serialization-networking-dotnet8to9.md -
Windows Forms nullability annotation changes — Some WinForms API parameters changed from nullable to non-nullable. Update call sites. See.
references/winforms-wpf-dotnet8to9.md -
Windows Forms security analyzers (WFO1000) — New analyzers produce errors for properties without explicit serialization configuration. See.
references/winforms-wpf-dotnet8to9.md
Build again after each batch of fixes. Repeat until the build is clean.
系统地处理编译错误和新警告。根据项目类型加载相应的参考文档:
| 如果项目使用… | 加载参考文档 |
|---|---|
| 任意 .NET 9 项目 | |
| 任意 .NET 9 项目 | |
| 任意 .NET 9 项目 | |
| ASP.NET Core | |
| Entity Framework Core | |
| 加密 API | |
| System.Text.Json、HttpClient、网络 | |
| Windows Forms 或 WPF | |
| Docker 容器、原生互操作 | |
| 运行时配置、部署 | |
需检查的常见源代码不兼容变更:
-
span 重载解析——
params、String.Join、String.Concat、Path.Combine等方法新增的Task.WhenAll重载现在会被优先绑定。在params ReadOnlySpan<T>lambda 中调用这些方法的代码会失败(CS8640/CS9226)。请参阅Expression。references/core-libraries-dotnet8to9.md -
重载歧义——
StringValues特性会导致params Span<T>、String.Concat、String.Join等方法与Path.Combine隐式运算符产生歧义。通过显式转换参数来修复。请参阅StringValues。references/core-libraries-dotnet8to9.md -
新的过时警告(SYSLIB0054–SYSLIB0057):
- :将
SYSLIB0054/Thread.VolatileRead替换为VolatileWrite/Volatile.ReadVolatile.Write - :将
SYSLIB0057/X509Certificate2二进制/文件构造函数替换为X509Certificate方法X509CertificateLoader - 还有 (ARM AdvSimd 有符号重载)和
SYSLIB0055(带哈希算法的SYSLIB0056)——请参阅Assembly.LoadFromreferences/core-libraries-dotnet8to9.md
-
C# 13 记录结构体上的——现在不允许在
InlineArray类型上使用record struct属性(CS9259)。将其改为常规[InlineArray]。请参阅struct。references/csharp-compiler-dotnet8to9.md -
C# 13 迭代器安全上下文——C# 13 中迭代器现在会引入安全上下文。迭代器内部使用不安全代码的本地函数如果继承自外部类,现在会报错。为本地函数添加
unsafe修饰符。请参阅unsafe。references/csharp-compiler-dotnet8to9.md -
C# 13 集合表达式重载解析——空集合表达式()不再使用 span 与非 span 来区分重载。现在优先选择精确匹配元素类型。请参阅
[]。references/csharp-compiler-dotnet8to9.md -
已移除——针对 .NET 9 预览版编译的、向
String.Trim(params ReadOnlySpan<char>)/Trim/TrimStart传递TrimEnd的代码必须重新编译;该重载在正式版中已被移除。请参阅ReadOnlySpan<char>。references/core-libraries-dotnet8to9.md -
始终抛出异常——如果项目使用
BinaryFormatter,请停止操作并告知用户——这是一个重大决策。请参阅BinaryFormatter。references/serialization-networking-dotnet8to9.md -
可为空——该属性现在为
HttpListenerRequest.UserAgent。添加空值检查。请参阅string?。references/serialization-networking-dotnet8to9.md -
Windows Forms 可空性注解变更——部分 WinForms API 参数从可空改为非可空。更新调用位置。请参阅。
references/winforms-wpf-dotnet8to9.md -
Windows Forms 安全分析器(WFO1000)——新的分析器会对未配置显式序列化的属性产生错误。请参阅。
references/winforms-wpf-dotnet8to9.md
每修复一批问题后重新构建。重复此过程直至构建成功。
Step 4: Address behavioral changes
步骤4:处理行为变更
Behavioral changes do not cause build errors but may change runtime behavior. Review each applicable item and determine whether the previous behavior was relied upon.
High-impact behavioral changes (check first):
-
Floating-point to integer conversions are now saturating — Conversions from/
floatto integer types now saturate instead of wrapping on x86/x64. Seedouble.references/deployment-runtime-dotnet8to9.md -
EF Core: Pending model changes exception —/
Migrate()now throws if the model has pending changes. Search forMigrateAsync(),DateTime.Now, orDateTime.UtcNowin anyGuid.NewGuid()call — these must be replaced with fixed constants (e.g.,HasData). Seenew DateTime(2024, 1, 1, 0, 0, 0, DateTimeKind.Utc).references/efcore-dotnet8to9.md -
EF Core: Explicit transaction exception —inside a user transaction now throws. See
Migrate().references/efcore-dotnet8to9.md -
HttpClientFactory usesby default — Code that casts the primary handler to
SocketsHttpHandlerwill getHttpClientHandler. SeeInvalidCastException.references/serialization-networking-dotnet8to9.md -
HttpClientFactory header redaction by default — All header values in-level logs are now redacted. See
Trace.references/serialization-networking-dotnet8to9.md -
Environment variables take precedence over runtimeconfig.json — Runtime configuration settings from environment variables now override. See
runtimeconfig.json.references/deployment-runtime-dotnet8to9.md -
ASP.NET Core/
ValidateOnBuildin development —ValidateScopesnow enables DI validation in development by default. SeeHostBuilder.references/aspnet-core-dotnet8to9.md
Other behavioral changes to review (may cause runtime exceptions ⚠️ or subtle behavioral differences):
- ⚠️ no longer injects non-keyed service fallback — throws
FromKeyedServicesAttributeInvalidOperationException - ⚠️ Container images no longer install zlib — apps depending on system zlib will fail
- ⚠️ Intel CET is now enabled by default — non-CET-compatible native libraries may cause process termination
- now has a maximum length of
BigIntegerbits(2^31) - 1 - deserialization of JSON
JsonDocumentnow returns non-nullnullwithJsonDocumentinstead of C#JsonValueKind.Nullnull - metadata reader now unescapes metadata property names
System.Text.Json - names/comments now respect the UTF-8 flag
ZipArchiveEntry - initial callback is now asynchronous
IncrementingPollingCounter - prepends rootDir to files
InMemoryDirectoryInfo - returns a different type
RuntimeHelpers.GetSubArray - raises
PictureBoxinstead ofHttpRequestExceptionWebException - uses a different default renderer
StatusStrip - support is opt-in
IMsoComponent - up-refs the handle
SafeEvpPKeyHandle.DuplicateHandle - metrics report
HttpClientunconditionallyserver.port - URI query strings redacted in HttpClient EventSource events and IHttpClientFactory logs
- is incompatible with Hot Reload for old frameworks
dotnet watch - WPF returns
GetXmlNamespaceMapsinstead ofHashtableString
行为变更不会导致构建错误,但可能会改变运行时行为。审查每个适用项并确定是否依赖于之前的行为。
高影响行为变更(优先检查):
-
浮点型转整型转换现在采用饱和模式——在 x86/x64 平台上,/
float转整型的转换现在会饱和而不是环绕。请参阅double。references/deployment-runtime-dotnet8to9.md -
EF Core:待处理模型变更异常——/
Migrate()现在会在模型有待处理变更时抛出异常。搜索所有MigrateAsync()调用中的HasData、DateTime.Now或DateTime.UtcNow——这些必须替换为固定常量(例如:Guid.NewGuid())。请参阅new DateTime(2024, 1, 1, 0, 0, 0, DateTimeKind.Utc)。references/efcore-dotnet8to9.md -
EF Core:显式事务异常——在用户事务中调用现在会抛出异常。请参阅
Migrate()。references/efcore-dotnet8to9.md -
HttpClientFactory 默认使用——将主处理程序强制转换为
SocketsHttpHandler的代码会抛出HttpClientHandler。请参阅InvalidCastException。references/serialization-networking-dotnet8to9.md -
HttpClientFactory 默认启用标头脱敏——级日志中的所有标头值现在都会被脱敏。请参阅
Trace。references/serialization-networking-dotnet8to9.md -
环境变量优先级高于 runtimeconfig.json——环境变量中的运行时配置设置现在会覆盖。请参阅
runtimeconfig.json。references/deployment-runtime-dotnet8to9.md -
ASP.NET Core 开发环境中的/
ValidateOnBuild——ValidateScopes现在在开发环境中默认启用依赖注入验证。请参阅HostBuilder。references/aspnet-core-dotnet8to9.md
其他需审查的行为变更(可能导致运行时异常 ⚠️ 或细微的行为差异):
- ⚠️ 不再注入非键控服务回退——会抛出
FromKeyedServicesAttributeInvalidOperationException - ⚠️ 容器镜像不再安装 zlib——依赖系统 zlib 的应用会失败
- ⚠️ Intel CET 现在默认启用——不兼容 CET 的原生库可能会导致进程终止
- 现在的最大长度为
BigInteger位(2^31) - 1 - 反序列化 JSON
JsonDocument现在会返回非空的null(JsonDocument)而非 C#JsonValueKind.Nullnull - 元数据读取器现在会对元数据属性名称进行转义还原
System.Text.Json - 名称/注释现在会遵循 UTF-8 标志
ZipArchiveEntry - 初始回调现在为异步
IncrementingPollingCounter - 会在文件前添加 rootDir
InMemoryDirectoryInfo - 返回不同的类型
RuntimeHelpers.GetSubArray - 现在抛出
PictureBox而非HttpRequestExceptionWebException - 使用不同的默认呈现器
StatusStrip - 支持为可选启用
IMsoComponent - 会向上引用句柄
SafeEvpPKeyHandle.DuplicateHandle - 指标会无条件报告
HttpClientserver.port - HttpClient EventSource 事件和 IHttpClientFactory 日志中的 URI 查询字符串会被脱敏
- 与旧框架的热重载不兼容
dotnet watch - WPF 返回
GetXmlNamespaceMaps而非HashtableString
Step 5: Update infrastructure
步骤5:更新基础设施
-
Dockerfiles: Update base images. Note that .NET 9 container images no longer install zlib. If your app depends on zlib, addto your Dockerfile.
RUN apt-get update && apt-get install -y zlib1gdockerfile# 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.0 -
CI/CD pipelines: Update SDK version references. If using, update:
global.jsonjson{ "sdk": { "version": "9.0.100", "rollForward": "latestFeature" } }Review thepolicy — if set torollForwardor"disable", the SDK may not resolve correctly after upgrading."latestPatch"(recommended) allows the SDK to roll forward to the latest 9.0.x feature band."latestFeature" -
Visual Studio version: .NET 9 SDK requires VS 17.12+ to target. VS 17.11 can only target
net9.0and earlier.net8.0 -
Terminal Logger:now uses Terminal Logger by default in interactive terminals. CI scripts that parse MSBuild console output may need
dotnet buildor--tl:off.MSBUILDTERMINALLOGGER=off -
output: Output format has changed. Update any scripts that parse workload command output.
dotnet workload -
.NET Monitor images: Tags simplified to version-only (affects container orchestration referencing specific tags).
-
Dockerfile:更新基础镜像。注意 .NET 9 容器镜像不再安装 zlib。如果应用依赖 zlib,请在 Dockerfile 中添加。
RUN apt-get update && apt-get install -y zlib1gdockerfile# 之前 FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build FROM mcr.microsoft.com/dotnet/aspnet:8.0 # 之后 FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build FROM mcr.microsoft.com/dotnet/aspnet:9.0 -
CI/CD 流水线:更新 SDK 版本引用。如果使用,请更新:
global.jsonjson{ "sdk": { "version": "9.0.100", "rollForward": "latestFeature" } }审查策略——如果设置为rollForward或"disable",升级后 SDK 可能无法正确解析。推荐使用"latestPatch",它允许 SDK 向前兼容至最新的 9.0.x 功能版本。"latestFeature" -
Visual Studio 版本:.NET 9 SDK 需要 VS 17.12+ 才能以为目标框架。VS 17.11 仅支持以
net9.0及更早版本为目标框架。net8.0 -
终端日志记录器:现在在交互式终端中默认使用终端日志记录器。解析 MSBuild 控制台输出的 CI 脚本可能需要添加
dotnet build或设置--tl:off。MSBUILDTERMINALLOGGER=off -
输出:输出格式已变更。更新所有解析 workload 命令输出的脚本。
dotnet workload -
.NET Monitor 镜像:标签简化为仅包含版本(会影响引用特定标签的容器编排)。
Step 6: Verify
步骤6:验证
- Run a full clean build:
dotnet build --no-incremental - Run all tests:
dotnet test - If the application is containerized, build and test the container image
- Smoke-test the application, paying special attention to:
- BinaryFormatter usage (will throw at runtime)
- Floating-point to integer conversion behavior
- EF Core migration application
- HttpClientFactory handler casting and logging
- DI validation in development environment
- Runtime configuration settings (environment variable precedence)
- Review the diff and ensure no unintended behavioral changes were introduced
- 执行完整的清理构建:
dotnet build --no-incremental - 运行所有测试:
dotnet test - 如果应用是容器化的,请构建并测试容器镜像
- 对应用进行冒烟测试,特别关注以下内容:
- BinaryFormatter 使用情况(运行时会抛出异常)
- 浮点型转整型的转换行为
- EF Core 迁移应用
- HttpClientFactory 处理程序强制转换和日志
- 开发环境中的依赖注入验证
- 运行时配置设置(环境变量优先级)
- 审查差异,确保未引入非预期的行为变更
Reference Documents
参考文档
The folder contains detailed breaking change information organized by technology area. Load only the references relevant to the project being migrated:
references/| 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 |
references/| 参考文件 | 加载时机 |
|---|---|
| 始终加载(C# 13 编译器重大变更——记录结构体上的 InlineArray、迭代器安全上下文、集合表达式重载) |
| 始终加载(适用于所有 .NET 9 项目) |
| 始终加载(SDK 和构建工具变更) |
| 项目使用 ASP.NET Core 时 |
| 项目使用 Entity Framework Core 时 |
| 项目使用 System.Security.Cryptography 或 X.509 证书时 |
| 项目使用 BinaryFormatter、System.Text.Json、HttpClient 或网络 API 时 |
| 项目使用 Windows Forms 或 WPF 时 |
| 项目使用 Docker 容器或原生互操作(P/Invoke)时 |
| 项目使用运行时配置、部署或存在浮点型转整型转换时 |