Support GitHub Actions annotations for project-level NuGet warnings without line numbers (e.g. NU1506)

未关闭
#807 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
57/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
github-actions, typescript
领域
ci-cd, tooling

调研方向

Start by reading the existing .github/csc.json problem matcher and compare its patterns with the NU1506 log examples in this issue. Check how the matcher is registered in the GitHub Actions workflow and inspect related changes from issue #717. Done means a project-level NuGet warning without line or column information produces an annotation associated with its project file.

由索引模型根据 Issue 内容生成。

描述

bug needs triage

Description

actions/setup-dotnet@v5 registers a problem matcher for .NET diagnostics, but some NuGet warnings, such as NU1506, are not recognized and therefore do not appear as GitHub Actions annotations.

For example, the following warnings appear in the build output:

D:\a\WinGetJet\WinGetJet\WinGetJet\WindowsPackageManager.Tests\WindowsPackageManager.Tests.csproj : warning NU1506: Duplicate 'PackageVersion' items found. Remove the duplicate items or use the Update functionality to ensure a consistent restore behavior. The duplicate 'PackageVersion' items are: Microsoft.WindowsPackageManager.ComInterop 1.29.380, Microsoft.WindowsPackageManager.ComInterop 1.29.380.
D:\a\WinGetJet\WinGetJet\WinGetJet\WindowsPackageManager\WindowsPackageManager.csproj : warning NU1506: Duplicate 'PackageVersion' items found. Remove the duplicate items or use the Update functionality to ensure a consistent restore behavior. The duplicate 'PackageVersion' items are: Microsoft.WindowsPackageManager.ComInterop 1.29.380, Microsoft.WindowsPackageManager.ComInterop 1.29.380.
D:\a\WinGetJet\WinGetJet\WinGetJet\WinGetJet\WinGetJet.csproj : warning NU1506: Duplicate 'PackageVersion' items found. Remove the duplicate items or use the Update functionality to ensure a consistent restore behavior. The duplicate 'PackageVersion' items are: Microsoft.WindowsPackageManager.ComInterop 1.29.380, Microsoft.WindowsPackageManager.ComInterop 1.29.380.

These are valid NuGet warnings, but they do not produce annotations in GitHub Actions.

Steps to reproduce

  1. Configure central package management with duplicate PackageVersion entries.
  2. Use actions/setup-dotnet@v5 in a GitHub Actions workflow.
  3. Run dotnet restore or dotnet build.
  4. Observe the NU1506 warnings in the workflow logs.

Expected behavior

NuGet warnings that reference a project file should produce GitHub Actions warning annotations, even when no source line or column information is available.

Actual behavior

The warnings are visible in the workflow logs but are not reported as GitHub Actions annotations.

Possible cause

The existing csc.json problem matcher requires:

  • A line number, optionally followed by a column number.
  • A trailing project path enclosed in square brackets.

However, project-level NuGet warnings such as NU1506 do not necessarily provide either.

Suggested improvement

Extend the existing problem matcher or register an additional matcher to support .NET/NuGet diagnostics without line and column information.

These diagnostics should still be associated with the referenced project file.

Related issues

  • #603 — Add problem matcher for NuGetAudit (closed as not planned)
  • #605 — Add msbuild.json as problem matcher (closed without merging)
  • #717 — Expand the CSC problem matcher (merged)

Although these address related diagnostic-matching problems, the NU1506 output format is still not supported by the matcher included in setup-dotnet@v5.

Justification

Missing annotations make NuGet warnings harder to discover, especially in large projects where build logs can contain extensive output.

Supporting project-level NuGet diagnostics would improve warning visibility in GitHub Actions job summaries and pull requests without requiring each repository to maintain a custom problem matcher.

主要语言
TypeScript
星标
1.2k
派生
579
平均合并
6 天 4 小时
30 天内合并 PR
1

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

actions/setup-dotnet 的其他 Issue

查看 actions/setup-dotnet 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。