ln-712-nuget-upgrader

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

ln-712-nuget-upgrader

ln-712-nuget-upgrader

Type: L3 Worker Category: 7XX Project Bootstrap Parent: ln-710-dependency-upgrader
Upgrades .NET NuGet packages with automatic breaking change detection and migration.

类型: L3 Worker 分类: 7XX 项目引导 父级: ln-710-dependency-upgrader
升级.NET NuGet包,具备自动破坏性变更检测与迁移功能。

Overview

概述

AspectDetails
InputSolution/project path
OutputUpdated .csproj files, migration report
Supports.NET 6, 7, 8, 9, 10

方面详情
输入解决方案/项目路径
输出更新后的.csproj文件、迁移报告
支持版本.NET 6, 7, 8, 9, 10

Workflow

工作流程

See diagram.html for visual workflow.
Phases: Pre-flight → Find Projects → Security Audit → Check Outdated → Identify Breaking → Apply Upgrades → Restore & Build → Report

查看diagram.html获取可视化工作流程。
阶段: 预检 → 查找项目 → 安全审计 → 检查过时包 → 识别破坏性变更 → 应用升级 → 还原与构建 → 生成报告

Phase 0: Pre-flight Checks

阶段0:预检检查

CheckRequiredAction if Missing
.csproj file(s)YesBlock upgrade
.sln fileNoUse csproj discovery instead
Workers assume coordinator (ln-710) already verified git state and created backup.

检查项是否必需缺失时操作
.csproj文件阻止升级
.sln文件改为使用csproj自动发现
Worker 假设协调器(ln-710)已验证git状态并创建备份。

Phase 1: Find Projects

阶段1:查找项目

Discovery Methods

发现方式

MethodCommand
Find .csproj
Get-ChildItem -Recurse -Filter *.csproj
From solution
dotnet sln list

方式命令
查找.csproj
Get-ChildItem -Recurse -Filter *.csproj
从解决方案获取
dotnet sln list

Phase 2: Security Audit

阶段2:安全审计

Commands

命令

CheckCommand
Vulnerable packages
dotnet list package --vulnerable
Outdated packages
dotnet list package --outdated
检查项命令
存在漏洞的包
dotnet list package --vulnerable
过时包
dotnet list package --outdated

Actions

操作

SeverityAction
CriticalBlock upgrade, report
HighWarn, continue
Moderate/LowLog only

严重程度操作
严重阻止升级,生成报告
发出警告,继续执行
中/低仅记录日志

Phase 3: Check Outdated

阶段3:检查过时包

Using dotnet-outdated

使用dotnet-outdated

StepCommand
Install tool
dotnet tool install --global dotnet-outdated-tool
Check
dotnet outdated --output json

步骤命令
安装工具
dotnet tool install --global dotnet-outdated-tool
检查
dotnet outdated --output json

Phase 4: Identify Breaking Changes

阶段4:识别破坏性变更

Detection

检测方式

  1. Compare current vs latest major versions
  2. Check breaking_changes_patterns.md
  3. Use MCP tools (see below) for migration guides
  1. 对比当前版本与最新主版本
  2. 查看breaking_changes_patterns.md
  3. 使用MCP工具(见下文)获取迁移指南

Common Breaking Changes

常见破坏性变更

PackageBreaking VersionKey Changes
Microsoft.EntityFrameworkCore8 → 9Query changes, migration format
Serilog.AspNetCore7 → 8Configuration format
Swashbuckle.AspNetCore6 → 7Minimal API support

存在破坏性变更的版本主要变更
Microsoft.EntityFrameworkCore8 → 9查询变更、迁移格式
Serilog.AspNetCore7 → 8配置格式
Swashbuckle.AspNetCore6 → 7极简API支持

MCP Tools for Migration Search

用于迁移搜索的MCP工具

Priority Order (Fallback Strategy)

优先级顺序(回退策略)

PriorityToolWhen to Use
1mcp__context7__query-docsFirst choice for library docs
2mcp__Ref__ref_search_documentationOfficial Microsoft docs
3WebSearchLatest info, community solutions
优先级工具使用场景
1mcp__context7__query-docs库文档的首选工具
2mcp__Ref__ref_search_documentation官方Microsoft文档
3WebSearch最新信息、社区解决方案

Context7 Usage

Context7使用方法

StepToolParameters
1. Find librarymcp__context7__resolve-library-idlibraryName: "EntityFrameworkCore"
2. Query docsmcp__context7__query-docsquery: "EF Core 8 to 9 migration breaking changes"
步骤工具参数
1. 查找库mcp__context7__resolve-library-idlibraryName: "EntityFrameworkCore"
2. 查询文档mcp__context7__query-docsquery: "EF Core 8 to 9 migration breaking changes"

MCP Ref Usage

MCP Ref使用方法

ActionToolQuery Example
Searchmcp__Ref__ref_search_documentation"dotnet EntityFrameworkCore 9 migration guide"
Readmcp__Ref__ref_read_urlURL 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无结果时使用:
  • "<package> .NET <version> breaking changes migration"
  • "<error code> <package> fix"

Phase 5: Apply Upgrades

阶段5:应用升级

Priority Order

优先级顺序

PriorityPackage Type
1SDK/Runtime (Microsoft.NET.Sdk)
2Framework (Microsoft.AspNetCore.*)
3EF Core (affects migrations)
4Logging (Serilog.*)
5Other packages
优先级包类型
1SDK/运行时(Microsoft.NET.Sdk)
2框架包(Microsoft.AspNetCore.*)
3EF Core(影响迁移)
4日志包(Serilog.*)
5其他包

Commands

命令

ActionCommand
Update specific
dotnet add package <name> --version <ver>
Update all
dotnet outdated --upgrade

操作命令
更新特定包
dotnet add package <name> --version <ver>
更新所有包
dotnet outdated --upgrade

Phase 6: Restore & Build

阶段6:还原与构建

Commands

命令

StepCommand
Restore
dotnet restore
Build
dotnet build --configuration Release
Test
dotnet test
步骤命令
还原
dotnet restore
构建
dotnet build --configuration Release
测试
dotnet test

On Failure

失败处理

  1. Identify failing package from error
  2. Search Context7/Ref for migration guide
  3. If unresolved: rollback package, continue

  1. 从错误中识别失败的包
  2. 在Context7/Ref中搜索迁移指南
  3. 若仍未解决:回滚该包,继续执行

Phase 7: Report Results

阶段7:生成报告

Report Schema

报告结构

FieldDescription
solutionSolution path
projects[]Updated projects
durationTotal time
upgrades[]Applied upgrades
buildVerificationPASSED or FAILED
testResultsX passed, Y failed

字段描述
solution解决方案路径
projects[]已更新的项目
duration总耗时
upgrades[]已应用的升级
buildVerification成功或失败
testResultsX通过,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: true

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: true

Error Handling

错误处理

ErrorCauseSolution
CS0246Missing typeSearch for replacement API
NU1605Downgrade detectedCheck package constraints
Build failBreaking changeApply migration via Context7

错误原因解决方案
CS0246缺失类型搜索替代API
NU1605检测到降级检查包约束
构建失败破坏性变更通过Context7应用迁移方案

References

参考资料

  • breaking_changes_patterns.md
  • dotnet_version_matrix.md

Version: 1.1.0 Last Updated: 2026-01-10
  • breaking_changes_patterns.md
  • dotnet_version_matrix.md

版本: 1.1.0 最后更新: 2026-01-10