migrate-dotnet10-to-dotnet11
它能做什么
这项技能把 .NET 10 项目或解决方案升级到 .NET 11,并在过程中修复破坏性改动。适合希望把现有应用迁移到新版本的团队。这项技能注明,在编写时 .NET 11 仍处于预览阶段。
适用场景
- ✓当你想把项目的目标从 net10.0 改为 net11.0 时。
- ✓当更新到 .NET 11 SDK 后出现构建错误或新警告时。
- ✓当迁移到 .NET 11 后运行时或框架行为发生变化的时候。
技能链接
https://github.com/dotnet/skills/blob/main/plugins/dotnet-upgrade/skills/migrate-dotnet10-to-dotnet11/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请把我的项目从 .NET 10 升级到 .NET 11,并修复升级导致的任何构建错误。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会检查项目、更新目标框架、按顺序处理破坏性改动,并进行构建和测试,直到结果干净为止。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
.NET 10 → .NET 11 Migration
Migrate a .NET 10 project or solution to .NET 11, systematically resolving all breaking changes. The outcome is a project targeting net11.0 that builds cleanly, passes tests, and accounts for every behavioral, source-incompatible, and binary-incompatible change introduced in .NET 11.
Note: .NET 11 is currently in preview. This skill covers breaking changes documented through Preview 3.
When to Use
- Upgrading
TargetFrameworkfromnet10.0tonet11.0 - Resolving build errors or new warnings after updating the .NET 11 SDK
- Adapting to behavioral changes in .NET 11 runtime, ASP.NET Core 11, or EF Core 11
- Updating CI/CD pipelines, Dockerfiles, or deployment scripts for .NET 11
- Fixing C# 15 compiler breaking changes after SDK upgrade
When Not to Use
- The project already targets
net11.0and builds cleanly — migration is done - Upgrading from .NET 9 or earlier — address the .NET 9→10 breaking changes first
- Migrating from .NET Framework — that is a separate, larger effort
- Greenfield projects that start on .NET 11 (no migration needed)
Inputs
| Input | Required | Description |
|---|---|---|
| Project or solution path | Yes | The .csproj, .sln, or .slnx entry point to migrate |
| Build command | No | How to build (e.g., dotnet build, a repo build script). Auto-detect if not provided |
| Test command | No | How to run tests (e.g., dotnet test). Auto-detect if not provided |
| Project type hints | No | Whether the project uses ASP.NET Core, EF Core, Cosmos DB, etc. Auto-detect from PackageReferences and SDK attributes if not provided |
Workflow
Answer directly from the loaded reference documents for information about .NET 11 breaking changes. You may inspect the local repository (project/solution files, source code, configuration, build/test scripts) as needed to determine which changes apply. Do not fetch web pages or other external sources for breaking change information — the loaded references are the authoritative source. 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.
Step 1: Assess the project
- Identify how the project is built and tested. Look for build scripts,
.sln/.slnxfiles, or individual.csprojfiles. - Run
dotnet --versionto confirm the .NET 11 SDK is installed. If it is not, stop and inform the user. - Determine which technology areas the project uses by examining:
- SDK attribute:
Microsoft.NET.Sdk.Web→ ASP.NET Core;Microsoft.NET.Sdk.WindowsDesktopwith<UseWPF>or<UseWindowsForms>→ WPF/WinForms - PackageReferences:
Microsoft.EntityFrameworkCore.*→ EF Core;Microsoft.EntityFrameworkCore.Cosmos→ Cosmos DB provider - Dockerfile presence → Container changes relevant
- Cryptography API usage → DSA on macOS affected; AIA cert download changes relevant
- Compression API usage → DeflateStream/GZipStream/ZipArchive changes relevant
- TAR API usage → Header checksum validation and HardLink entry changes relevant
NamedPipeClientStreamusage withSafePipeHandle→ SYSLIB0063 constructor obsoletion relevantBackgroundServiceusage → Unhandled exceptions now stop the hostMicrosoft.OpenApidirect usage → v3 API breaking changes in ASP.NET Core OpenAPI- EF Core SQL Server with Entra ID auth → SqlClient 7.0 auth dependency changes
- NativeAOT native libraries on Unix → Output filename prefix changed
- SDK attribute:
- Record which reference documents are relevant (see the reference loading table in Step 3).
- Do a clean build (
dotnet build --no-incrementalor deletebin/obj) on the currentnet10.0target to establish a clean baseline. Record any pre-existing warnings.
Step 2: Update the Target Framework
In each
.csproj(orDirectory.Build.propsif centralized), change:<TargetFramework>net10.0</TargetFramework>to:
<TargetFramework>net11.0</TargetFramework>For multi-targeted projects, add
net11.0to<TargetFrameworks>or replacenet10.0.Update all
Microsoft.Extensions.*,Microsoft.AspNetCore.*, `Microsoft.EntityFrameworkCore
常见问题
它适用于 .NET 9 项目吗?
不适用。它涵盖从 .NET 10 到 .NET 11 的这一步,较旧的项目需要先完成各自的迁移。
它会更新流水线和 Dockerfile 吗?
会。这项技能涵盖为 .NET 11 更新 CI 和部署文件。
.NET 11 已经稳定了吗?
这项技能涵盖通过预览版本记录的改动,因此在升级正式应用之前,请先确认当前的发布状态。
详情
作者的原始描述
Migrate a .NET 10 project or solution to .NET 11 and resolve all breaking changes. This is a MIGRATION skill — use it when upgrading from .NET 10 to .NET 11, NOT for writing new programs. USE FOR: upgrading TargetFramework from net10.0 to net11.0, fixing build errors after updating the .NET 11 SDK, resolving source-breaking and behavioral changes in .NET 11 runtime, C# 15 compiler, and EF Core 11, adapting to updated minimum hardware requirements (x86-64-v2, Arm64 LSE), and updating CI/CD pipelines and Dockerfiles for .NET 11. DO NOT USE FOR: .NET Framework migrations, upgrading from .NET 9 or
repo: dotnet/skills
热度
- GitHub 星标
- 5.8k
- 排名
- #14645
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
create-custom-agent
5.8k帮你的智能体创建 VS Code 自定义智能体文件,为每个智能体设置专属工具、指令以及向其他智能体的交接。
create-skill
5.8k帮你的智能体创建新的智能体技能,包括有效的名称、清晰的触发描述,以及符合标准的 SKILL.md 文件。
csharp-scripts
5.8k帮你的智能体通过 .NET 命令行工具以单个文件运行小型 C# 程序,无需创建完整项目。
dotnet-pinvoke
5.8k帮你的智能体在 .NET 中正确调用原生 C 或 C++ 库,涵盖函数签名、字符串处理、内存和安全句柄。