migrate-dotnet8-to-dotnet9
Skill này làm gì
Skill này nâng cấp dự án hoặc solution .NET 8 lên .NET 9 và sửa các breaking change trong quá trình đó. Dành cho các nhóm đang chuyển một ứng dụng hiện có sang .NET 9.
Khi nào nên dùng
- ✓Khi bạn muốn đổi target của dự án từ net8.0 sang net9.0.
- ✓Khi xuất hiện lỗi build hoặc cảnh báo mới sau khi cập nhật lên SDK .NET 9.
- ✓Khi code dùng BinaryFormatter, vì nó giờ luôn ném lỗi khi chạy.
Liên kết skill
https://github.com/dotnet/skills/blob/main/plugins/dotnet-upgrade/skills/migrate-dotnet8-to-dotnet9/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Hãy nâng cấp ứng dụng web .NET 8 của tôi lên .NET 9 và sửa mọi thứ bị lỗi.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent kiểm tra dự án, cập nhật target, xử lý từng breaking change, rồi build và chạy test cho đến khi ứng dụng chạy sạch trên .NET 9.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
.NET 8 → .NET 9 Migration
Migrate a .NET 8 project or solution to .NET 9, systematically resolving all breaking changes. The outcome is a project targeting net9.0 that builds cleanly, passes tests, and accounts for every behavioral, source-incompatible, and binary-incompatible change introduced in the .NET 9 release.
When to Use
- Upgrading
TargetFrameworkfromnet8.0tonet9.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
BinaryFormatterusage (now always throws at runtime) - Updating CI/CD pipelines, Dockerfiles, or deployment scripts for .NET 9
When Not to Use
- The project already targets
net9.0and builds cleanly — migration is done. If the goal is to reachnet10.0, use themigrate-dotnet9-to-dotnet10skill as the next step. - 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)
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, WinForms, WPF, containers, etc. Auto-detect from PackageReferences and SDK attributes if not provided |
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.
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 9 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.Extensions.Http→ HttpClientFactory - Dockerfile presence → Container changes relevant
- P/Invoke or native interop usage → Interop changes relevant
BinaryFormatterusage → Serialization migration neededSystem.Text.Jsonusage → Serialization changes relevant- 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 (
dotnet build --no-incrementalor deletebin/obj) on the currentnet8.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>net8.0</TargetFramework>to:
<TargetFramework>net9.0</TargetFramework>For multi-targeted projects, add
net9.0to<TargetFrameworks>or replacenet8.0.Update all
Microsoft.Extensions.*,Microsoft.AspNetCore.*,Microsoft.EntityFrameworkCore.*, and other Microsoft package references to their 9.0.x versions. If using Central Package Management (Directory.Packages.props), update versions there.Run
dotnet restore. Watch for:- Version requirements: .NET 9 SDK requires Visual Studio 17.12+ to target
net9.0(17.11 fornet8.0and earlier). - 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.
Step 3: Resolve build errors and source-incompatible changes
Work through compilation errors a
Câu hỏi thường gặp
Nó có bao quát .NET 10 không?
Không. Việc chuyển từ .NET 9 lên .NET 10 là một skill riêng, bạn dùng sau skill này.
Nó có bao quát thay đổi của ASP.NET Core và EF Core không?
Có. Nó cũng bao quát các thay đổi hành vi trong ASP.NET Core 9 và EF Core 9.
Nó có bao quát ứng dụng .NET Framework không?
Không. Chuyển từ .NET Framework là một việc lớn hơn và không thuộc skill này.
Chi tiết
Mô tả gốc của tác giả
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, greenfie
repo: dotnet/skills
Độ phổ biến
- Sao GitHub
- 5.8k
- Vị trí xếp hạng
- #14646
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
create-custom-agent
5.8kGiúp agent của bạn tạo file custom agent cho VS Code, với các tool, hướng dẫn và handoff riêng sang agent khác.
create-skill
5.8kGiúp agent của bạn tạo một agent skill mới với tên hợp lệ, mô tả kích hoạt rõ ràng và file SKILL.md đúng tiêu chuẩn.
csharp-scripts
5.8kGiúp agent của bạn chạy một chương trình C# nhỏ dưới dạng một file duy nhất bằng công cụ dòng lệnh .NET, không cần tạo project đầy đủ.
dotnet-pinvoke
5.8kGiúp agent của bạn gọi các thư viện native C hoặc C++ từ .NET đúng cách, gồm khai báo chữ ký, xử lý chuỗi, bộ nhớ và safe handle.
Skill tương tự
openclaw-update
394kGiúp agent của bạn cập nhật OpenClaw Gateway đang có, chọn cách cập nhật phù hợp với cách cài đặt và giữ phiên làm việc của bạn hoạt động.
diagnose-gateway
394kGiúp agent của bạn tìm hiểu vì sao OpenClaw Gateway bị lỗi bằng cách kiểm tra cài đặt, kênh và cổng mà không thay đổi gì.
crabbox-apps
394kGiúp agent của bạn mở và chạy một app trên máy đám mây tạm thời, rồi hiển thị giao diện của nó trong thanh bên của chat.