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

Đang mở
#807 0 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
57/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
github-actions, typescript
Lĩnh vực
ci-cd, tooling

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
1.2k
Fork
579
Merge trung bình
6 ngày 4 giờ
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của actions/setup-dotnet

Tất cả issue của actions/setup-dotnet

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.