Loading...
Loading...
Compare original and translation side by side
<TargetFramework>.csprojDirectory.Build.props| Current TFM | Status | Recommendation |
|---|---|---|
| LTS -- supported until Nov 2026 | Plan upgrade to |
| STS -- support ends May 2026 | Upgrade to |
| End of life | Upgrade immediately |
| End of life | Upgrade immediately |
| End of life | Upgrade immediately |
| Supported (library compat) | Keep if multi-targeting for broad reach |
| End of life | Upgrade immediately |
| Legacy | Evaluate migration feasibility |
undefined.csprojDirectory.Build.props<TargetFramework>| 当前TFM | 状态 | 建议 |
|---|---|---|
| 长期支持版(LTS)——支持至2026年11月 | 计划升级至 |
| 标准支持版(STS)——支持至2026年5月 | 及时升级至 |
| 已终止支持 | 立即升级 |
| 已终止支持 | 立即升级 |
| 已终止支持 | 立即升级 |
| 受支持(库兼容性) | 若需多目标框架以覆盖广泛场景则保留 |
| 已终止支持 | 立即升级 |
| 遗留版本 | 评估迁移可行性 |
undefined
---
---Directory.Packages.props.csproj| Deprecated Package | Replacement | Since |
|---|---|---|
| | .NET 8 |
| | .NET Core 3.0+ |
| Built-in STJ | .NET Core 3.0+ |
| Built-in OpenAPI ( | .NET 9 |
| Built-in OpenAPI for document generation; keep NSwag if using client generation or Swagger UI features | .NET 9 |
| Built-in logging + | .NET Core 2.0+ |
| Remove explicit PackageReference — included in | .NET Core 3.0+ |
| | .NET Core 3.0+ |
| | 2020+ |
| | 2020+ |
| | 2020+ |
| | 2020+ |
| | .NET Core 1.0+ |
| | .NET Core+ |
| Manual mapping or source-generated mappers | Preference |
undefinedDirectory.Packages.props.csproj| 已弃用包 | 替代方案 | 起始版本 |
|---|---|---|
| | .NET 8 |
| | .NET Core 3.0+ |
| 内置STJ | .NET Core 3.0+ |
| 内置OpenAPI( | .NET 9 |
| 内置OpenAPI用于文档生成;若使用客户端生成或Swagger UI功能则保留NSwag | .NET 9 |
| 内置日志 + | .NET Core 2.0+ |
| 移除显式PackageReference —— 已包含在 | .NET Core 3.0+ |
| | .NET Core 3.0+ |
| | 2020+ |
| | 2020+ |
| | 2020+ |
| | 2020+ |
| | .NET Core 1.0+ |
| | .NET Core+ |
| 手动映射或源生成映射器 | 按需选择 |
undefined
**Note on Newtonsoft.Json:** Existing projects with deep Newtonsoft.Json usage (custom converters, `JObject` manipulation) may not benefit from immediate migration. Flag it but assess the migration cost.
---
**关于Newtonsoft.Json的说明:** 若现有项目深度依赖Newtonsoft.Json(如自定义转换器、`JObject`操作),可能无法从立即迁移中获益。标记该问题并评估迁移成本。
---public class Startup
{
public void ConfigureServices(IServiceCollection services) { }
public void Configure(IApplicationBuilder app) { }
}var builder = WebApplication.CreateBuilder(args);
// ConfigureServices equivalent
var app = builder.Build();
// Configure equivalent
app.Run();public class Startup
{
public void ConfigureServices(IServiceCollection services) { }
public void Configure(IApplicationBuilder app) { }
}var builder = WebApplication.CreateBuilder(args);
// 对应ConfigureServices
var app = builder.Build();
// 对应Configure
app.Run();services.AddHttpClient<MyService>(client =>
{
client.BaseAddress = new Uri("https://api.example.com");
})
.AddTransientHttpErrorPolicy(p => p.WaitAndRetryAsync(3, _ => TimeSpan.FromMilliseconds(300)));services.AddHttpClient<MyService>(client =>
{
client.BaseAddress = new Uri("https://api.example.com");
})
.AddStandardResilienceHandler();services.AddHttpClient<MyService>(client =>
{
client.BaseAddress = new Uri("https://api.example.com");
})
.AddTransientHttpErrorPolicy(p => p.WaitAndRetryAsync(3, _ => TimeSpan.FromMilliseconds(300)));services.AddHttpClient<MyService>(client =>
{
client.BaseAddress = new Uri("https://api.example.com");
})
.AddStandardResilienceHandler();File.ReadAllTextStream.ReadHttpClientAsyncasyncFile.ReadAllTextAsyncStream.ReadAsyncawait httpClient.GetAsync()File.ReadAllTextStream.ReadAsyncHttpClientFile.ReadAllTextAsyncStream.ReadAsyncawait httpClient.GetAsync()+String.FormatLoggerMessageStringBuilder+String.FormatLoggerMessageStringBuilderHashtableArrayListDictionary<TKey, TValue>List<T>HashtableArrayListDictionary<TKey, TValue>List<T>_logger.LogInformation("Processing order {OrderId}", orderId);[LoggerMessage(Level = LogLevel.Information, Message = "Processing order {OrderId}")]
static partial void LogProcessingOrder(ILogger logger, string orderId);_logger.LogInformation("Processing order {OrderId}", orderId);[LoggerMessage(Level = LogLevel.Information, Message = "Processing order {OrderId}")]
static partial void LogProcessingOrder(ILogger logger, string orderId);| Missing | Check | Recommendation |
|---|---|---|
| Central Package Management | No | See [skill:dotnet-project-structure] |
| Directory.Build.props | Properties scattered across | Centralize shared properties |
| .editorconfig | No | See [skill:dotnet-project-structure] |
| global.json | No SDK pinning | Add for reproducible builds |
| NuGet audit | No | Enable in |
| Lock files | No | Enable for deterministic restores |
| Package source mapping | No | Add for supply-chain security |
| Analyzers | No | See [skill:dotnet-add-analyzers] |
| SourceLink | No SourceLink package reference | Add for debugger source navigation |
| Nullable reference types | | Enable globally |
| .slnx | Still using | Migrate with |
| 缺失项 | 检查方式 | 建议 |
|---|---|---|
| 中央包管理(Central Package Management) | 无 | 查看 [skill:dotnet-project-structure] |
| Directory.Build.props | 属性分散在多个 | 集中共享属性 |
| .editorconfig | 仓库根目录无 | 查看 [skill:dotnet-project-structure] |
| global.json | 未固定SDK版本 | 添加以实现可复现构建 |
| NuGet审计 | 无 | 在 |
| 锁定文件 | 无 | 启用以实现确定性还原 |
| 包源映射 | | 添加以提升供应链安全性 |
| 分析器 | 无 | 查看 [skill:dotnet-add-analyzers] |
| SourceLink | 无SourceLink包引用 | 添加以支持调试器源码导航 |
| 可空引用类型 | 未启用 | 全局启用 |
| .slnx | .NET 9+ SDK仍使用 | 使用 |
| Old Pattern | Modern Replacement | Language Version |
|---|---|---|
| | C# 8 |
| | C# 9 |
| Target-typed | C# 9 |
| Block-scoped namespaces | File-scoped namespaces | C# 10 |
| | C# 10 |
| Manual string concatenation for multi-line | Raw string literals ( | C# 11 |
Explicit interface dispatch for | Generic math interfaces | C# 11 |
| Improved enum pattern matching | C# 11+ |
| Lambda without natural type | Natural function types | C# 10+ |
| | C# all |
| Primary constructor classes (manual) | Primary constructors on | C# 12 |
Multiple | | C# 11+ |
| | C# 13 |
Lock with | | C# 13 |
| 旧模式 | 现代化替代方案 | 语言版本 |
|---|---|---|
带 | | C# 8 |
| | C# 9 |
显式类型的 | 目标类型 | C# 9 |
| 块级命名空间 | 文件级命名空间 | C# 10 |
| 带位置参数的 | C# 10 |
| 手动拼接多行字符串 | 原始字符串字面量( | C# 11 |
| 泛型数学接口 | C# 11 |
| 改进的枚举模式匹配 | C# 11+ |
| 无自然类型的Lambda表达式 | 自然函数类型 | C# 10+ |
手动包装 | 带 | 所有C#版本 |
| 手动实现主构造函数的类 | | C# 12 |
多个 | 基于类型和列表模式的 | C# 11+ |
| | C# 13 |
使用 | | C# 13 |
| Issue | Detection | Fix |
|---|---|---|
| Known vulnerabilities | | Update affected packages |
| Deprecated packages | | Replace with successors |
| Outdated packages | | Evaluate updates |
| Missing HTTPS redirection | No | Add to pipeline |
| Missing HSTS | No | Add for production |
| Hardcoded secrets | Connection strings in | Use User Secrets or Key Vault |
undefined| 问题 | 检测方式 | 修复方案 |
|---|---|---|
| 已知漏洞 | | 更新受影响的包 |
| 已弃用包 | | 替换为继任包 |
| 过时包 | | 评估更新必要性 |
| 缺失HTTPS重定向 | 无 | 添加到管道中 |
| 缺失HSTS | 无 | 生产环境添加 |
| 硬编码密钥 | | 使用用户密钥或密钥保管库 |
undefined
---
---undefinedundefined
---
---