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

Aperta
#807 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
57/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
github-actions, typescript
Ambito
ci-cd, tooling

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
1.2k
Fork
579
Merge medio
6g 4h
PR unite (30g)
1

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di actions/setup-dotnet

Tutte le issue di actions/setup-dotnet

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.