ln-822-nuget-upgrader
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePaths: File paths (,shared/,references/) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root.../ln-*
路径: 文件路径(、shared/、references/)是相对于技能仓库根目录的。如果在当前工作目录(CWD)中未找到,请定位此SKILL.md所在目录,然后向上一级目录即为仓库根目录。../ln-*
ln-822-nuget-upgrader
ln-822-nuget-upgrader
Type: L3 Worker
Category: 8XX Optimization
Parent: ln-820-dependency-optimization-coordinator
Upgrades .NET NuGet packages with automatic breaking change detection and migration.
类型: L3 Worker
分类: 8XX 优化
父级: ln-820-dependency-optimization-coordinator
升级.NET NuGet包,具备自动重大变更检测与迁移功能。
Overview
概述
| Aspect | Details |
|---|---|
| Input | Solution/project path |
| Output | Updated .csproj files, migration report |
| Supports | .NET 6, 7, 8, 9, 10 |
| 方面 | 详情 |
|---|---|
| 输入 | 解决方案/项目路径 |
| 输出 | 更新后的.csproj文件、迁移报告 |
| 支持版本 | .NET 6、7、8、9、10 |
Workflow
工作流程
Phases: Pre-flight → Find Projects → Security Audit → Check Outdated → Identify Breaking → Apply Upgrades → Restore & Build → Report
阶段: 预检 → 查找项目 → 安全审计 → 检查过时包 → 识别重大变更 → 应用升级 → 还原与构建 → 生成报告
Phase 0: Pre-flight Checks
阶段0:预检
| Check | Required | Action if Missing |
|---|---|---|
| .csproj file(s) | Yes | Block upgrade |
| .sln file | No | Use csproj discovery instead |
| Git clean state | Yes | Block (need clean baseline for revert) |
Workers assume coordinator (ln-820) already verified git state and created backup.
| 检查项 | 是否必需 | 缺失时操作 |
|---|---|---|
| .csproj文件 | 是 | 阻止升级 |
| .sln文件 | 否 | 改为自动发现.csproj |
| Git干净状态 | 是 | 阻止升级(需要干净的基线以便回滚) |
工作器(Worker)假设协调器(ln-820)已验证Git状态并创建备份。
Worktree & Branch Isolation
工作树与分支隔离
MANDATORY READ: Load — use ln-822 row.
shared/references/git_worktree_fallback.md必读: 加载— 使用ln-822相关内容。shared/references/git_worktree_fallback.md
Phase 1: Find Projects
阶段1:查找项目
Discovery Methods
发现方式
| Method | Command |
|---|---|
| Find .csproj | |
| From solution | |
| 方式 | 命令 |
|---|---|
| 查找.csproj | |
| 从解决方案获取 | |
Phase 2: Security Audit
阶段2:安全审计
Commands
命令
| Check | Command |
|---|---|
| Vulnerable packages | |
| Outdated packages | |
| 检查项 | 命令 |
|---|---|
| 存在漏洞的包 | |
| 过时的包 | |
Actions
操作
| Severity | Action |
|---|---|
| Critical | Block upgrade, report |
| High | Warn, continue |
| Moderate/Low | Log only |
| 严重程度 | 操作 |
|---|---|
| 严重 | 阻止升级并生成报告 |
| 高 | 发出警告并继续 |
| 中/低 | 仅记录日志 |
Phase 3: Check Outdated
阶段3:检查过时包
Using dotnet-outdated
使用dotnet-outdated
| Step | Command |
|---|---|
| Install tool | |
| Check | |
| 步骤 | 命令 |
|---|---|
| 安装工具 | |
| 检查 | |
Phase 4: Identify Breaking Changes
阶段4:识别重大变更
Detection
检测方式
- Compare current vs latest major versions
- Check breaking_changes_patterns.md
- Use MCP tools (see below) for migration guides
- 对比当前版本与最新主版本
- 查看breaking_changes_patterns.md
- 使用MCP工具(如下所示)查找迁移指南
Common Breaking Changes
常见重大变更
| Package | Breaking Version | Key Changes |
|---|---|---|
| Microsoft.EntityFrameworkCore | 8 → 9 | Query changes, migration format |
| Serilog.AspNetCore | 7 → 8 | Configuration format |
| Swashbuckle.AspNetCore | 6 → 7 | Minimal API support |
| 包 | 变更版本 | 主要变更 |
|---|---|---|
| Microsoft.EntityFrameworkCore | 8 → 9 | 查询逻辑变更、迁移格式变更 |
| Serilog.AspNetCore | 7 → 8 | 配置格式变更 |
| Swashbuckle.AspNetCore | 6 → 7 | Minimal API支持 |
MCP Tools for Migration Search
用于迁移搜索的MCP工具
Priority Order (Fallback Strategy)
优先级顺序(回退策略)
| Priority | Tool | When to Use |
|---|---|---|
| 1 | mcp__context7__query-docs | First choice for library docs |
| 2 | mcp__Ref__ref_search_documentation | Official Microsoft docs |
| 3 | WebSearch | Latest info, community solutions |
| 优先级 | 工具 | 使用场景 |
|---|---|---|
| 1 | mcp__context7__query-docs | 首选:查找库文档 |
| 2 | mcp__Ref__ref_search_documentation | 官方Microsoft文档 |
| 3 | WebSearch | 获取最新信息、社区解决方案 |
Context7 Usage
Context7使用方法
| Step | Tool | Parameters |
|---|---|---|
| 1. Find library | mcp__context7__resolve-library-id | libraryName: "EntityFrameworkCore" |
| 2. Query docs | mcp__context7__query-docs | query: "EF Core 8 to 9 migration breaking changes" |
| 步骤 | 工具 | 参数 |
|---|---|---|
| 1. 查找库 | mcp__context7__resolve-library-id | libraryName: "EntityFrameworkCore" |
| 2. 查询文档 | mcp__context7__query-docs | query: "EF Core 8 to 9 migration breaking changes" |
MCP Ref Usage
MCP Ref使用方法
| Action | Tool | Query Example |
|---|---|---|
| Search | mcp__Ref__ref_search_documentation | "dotnet EntityFrameworkCore 9 migration guide" |
| Read | mcp__Ref__ref_read_url | URL from search results |
| 操作 | 工具 | 查询示例 |
|---|---|---|
| 搜索 | mcp__Ref__ref_search_documentation | "dotnet EntityFrameworkCore 9 migration guide" |
| 读取 | mcp__Ref__ref_read_url | 搜索结果中的URL |
WebSearch Fallback
WebSearch回退方案
Use when Context7/Ref return no results:
"<package> .NET <version> breaking changes migration""<error code> <package> fix"
当Context7/Ref无结果时使用:
"<包名> .NET <版本> breaking changes migration""<错误代码> <包名> fix"
Phase 5: Apply Upgrades
阶段5:应用升级
Priority Order
优先级顺序
| Priority | Package Type |
|---|---|
| 1 | SDK/Runtime (Microsoft.NET.Sdk) |
| 2 | Framework (Microsoft.AspNetCore.*) |
| 3 | EF Core (affects migrations) |
| 4 | Logging (Serilog.*) |
| 5 | Other packages |
| 优先级 | 包类型 |
|---|---|
| 1 | SDK/运行时(Microsoft.NET.Sdk) |
| 2 | 框架(Microsoft.AspNetCore.*) |
| 3 | EF Core(影响迁移) |
| 4 | 日志组件(Serilog.*) |
| 5 | 其他包 |
Commands
命令
| Action | Command |
|---|---|
| Update specific | |
| Update all | |
| 操作 | 命令 |
|---|---|
| 更新特定包 | |
| 更新所有包 | |
Phase 6: Restore & Build
阶段6:还原与构建
Commands
命令
| Step | Command |
|---|---|
| Restore | |
| Build | |
| Test | |
| 步骤 | 命令 |
|---|---|
| 还原 | |
| 构建 | |
| 测试 | |
On Failure
失败处理
- Identify failing package from error
- Search Context7/Ref for migration guide
- If unresolved: rollback package, continue
- 从错误信息中定位失败的包
- 使用Context7/Ref查找迁移指南
- 若仍无法解决:回滚该包,继续执行其他升级
Phase 7: Report Results
阶段7:生成结果报告
Report Schema
报告格式
| Field | Description |
|---|---|
| solution | Solution path |
| projects[] | Updated projects |
| duration | Total time |
| upgrades[] | Applied upgrades |
| buildVerification | PASSED or FAILED |
| testResults | X passed, Y failed |
| 字段 | 描述 |
|---|---|
| solution | 解决方案路径 |
| projects[] | 已更新的项目 |
| duration | 总耗时 |
| upgrades[] | 已应用的升级 |
| buildVerification | 通过(PASSED)或失败(FAILED) |
| testResults | X个通过,Y个失败 |
Configuration
配置
yaml
Options:
# Upgrade scope
upgradeType: major # major | minor | patch
# Security
auditLevel: high
minimumReleaseAge: 14
# .NET specific
includePrerelease: false
targetFramework: net10.0
# Verification
runTests: true
runBuild: trueyaml
Options:
# 升级范围
upgradeType: major # major | minor | patch
# 安全设置
auditLevel: high
minimumReleaseAge: 14
# .NET特定配置
includePrerelease: false
targetFramework: net10.0
# 验证设置
runTests: true
runBuild: trueError Handling
错误处理
| Error | Cause | Solution |
|---|---|---|
| CS0246 | Missing type | Search for replacement API |
| NU1605 | Downgrade detected | Check package constraints |
| Build fail | Breaking change | Apply migration via Context7 |
| 错误 | 原因 | 解决方案 |
|---|---|---|
| CS0246 | 类型缺失 | 查找替代API |
| NU1605 | 检测到降级 | 检查包约束 |
| 构建失败 | 重大变更 | 通过Context7应用迁移方案 |
References
参考文档
- breaking_changes_patterns.md
- dotnet_version_matrix.md
- breaking_changes_patterns.md
- dotnet_version_matrix.md
Definition of Done
完成标准
- All .csproj files discovered (via solution or recursive scan)
- Security audit completed ()
dotnet list package --vulnerable - Outdated packages identified via dotnet-outdated
- Breaking changes detected via breaking_changes_patterns.md and MCP tools
- Upgrades applied in priority order (SDK > Framework > EF Core > other)
- ,
dotnet restore,dotnet buildall passdotnet test - Report returned with projects updated, upgrades applied, and build/test status
Version: 1.1.0
Last Updated: 2026-01-10
- 所有.csproj文件已被发现(通过解决方案或递归扫描)
- 安全审计已完成(执行)
dotnet list package --vulnerable - 通过dotnet-outdated识别出所有过时包
- 通过breaking_changes_patterns.md和MCP工具检测到重大变更
- 已按优先级顺序应用升级(SDK > 框架 > EF Core > 其他)
- 、
dotnet restore、dotnet build全部通过dotnet test - 已返回包含更新项目、已应用升级、构建/测试状态的报告
版本: 1.1.0
最后更新时间: 2026-01-10