Skip to content

Downgrade NU1901, NU1902, NU1903 to warnings and log them - #7922

Merged
ViktorHofer merged 10 commits into
mainfrom
MakeNuGetAuditActionable
Jul 29, 2026
Merged

ViktorHofer merged 10 commits into
mainfrom
MakeNuGetAuditActionable

Conversation

@ViktorHofer

@ViktorHofer ViktorHofer commented Jul 23, 2026 •

Copy link
Copy Markdown
Member

Let warnings get recognized and logged and downgrade NU1901, NU1902 and NU1903 from error to warning.

Tested locally, works perfectly. You can see the roslyn warnings in the CI run. They currently don't get promoted to the timeline because of the Arcade logger that got removed which will soon be back again (with the next re-bootstrap).

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@ViktorHofer
ViktorHofer force-pushed the MakeNuGetAuditActionable branch from b5fd303 to 5055816 Compare July 23, 2026 12:25
@dotnet-policy-service
dotnet-policy-service Bot requested review from a team July 23, 2026 15:30
@ViktorHofer
ViktorHofer marked this pull request as ready for review July 23, 2026 17:26
@ViktorHofer
ViktorHofer requested a review from a team as a code owner July 23, 2026 17:26
Copilot AI review requested due to automatic review settings July 23, 2026 17:26
@ViktorHofer
ViktorHofer requested a review from a team as a code owner July 23, 2026 17:26
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts VMR repo-build orchestration so NuGet audit warnings can be surfaced in repo build logs while preventing select NU190x audit warnings from failing the build.

Changes:

  • Allow /clp: arguments to pass through Roslyn and F# repo build scripts (bash + PowerShell).
  • Add a warnnotaserror configuration for NU1901–NU1903 and add /clp:NoSummary to common repo-build arguments.
  • Teach the VMR Exec wrapper to recognize NuGet warning lines via CustomWarningRegularExpression so they are logged as MSBuild warnings.
Show a summary per file
File Description
src/roslyn/eng/build.sh Accepts /clp: arguments and forwards them to MSBuild.
src/roslyn/eng/build.ps1 Allows /clp: in forwarded “remaining arguments” validation.
src/fsharp/eng/build.sh Accepts /clp: arguments and forwards them to MSBuild.
src/fsharp/eng/Build.ps1 Allows /clp: in forwarded “remaining arguments” validation.
repo-projects/Directory.Build.targets Adds an Exec warning-regex so NuGet warning output is recognized/logged as warnings.
repo-projects/Directory.Build.props Adds common args to demote NU1901–NU1903 and suppress console logger summary output.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 6/6 changed files
  • Comments generated: 2

Comment thread repo-projects/Directory.Build.props Resolved
Comment thread repo-projects/Directory.Build.targets Resolved
@ViktorHofer
ViktorHofer marked this pull request as draft July 23, 2026 18:21
@ViktorHofer ViktorHofer changed the title Downgrade NU1901-4 to warnings and log them Downgrade NU1901, NU1902, NU1903 to warnings and log them Jul 23, 2026
@dotnet-policy-service
dotnet-policy-service Bot requested a review from a team July 24, 2026 09:32
ViktorHofer and others added 4 commits July 24, 2026 12:12
The per-OS FlagParameterSemicolon used a backslash-escaped ';' on Unix,
which MSBuild normalized to '/', producing a malformed
"NU1901/;NU1902/;NU1903" list for the inner repo build and silently
dropping the NU1901/NU1902 downgrades. Escaping is only needed on
Windows (PowerShell Invoke-Expression in runtime's build.ps1); on other
platforms the quoted value goes straight to the shell where ';' is
literal. Condition the escaping to Windows and pass the raw list
elsewhere.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 383ea2c0-59cf-4fd9-b024-4bb649e4a07e
@ViktorHofer
ViktorHofer marked this pull request as ready for review July 24, 2026 17:54
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@ViktorHofer
ViktorHofer requested a review from mmitche July 24, 2026 17:59

@333fred 333fred left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Roslyn change seems fine. Did not review anything else.

@ViktorHofer

Copy link
Copy Markdown
Member Author

Merging. Happy to respond to more feedback in a follow-up.

@ViktorHofer
ViktorHofer merged commit 0b5109c into main Jul 29, 2026
11 checks passed
@akoeplinger

Copy link
Copy Markdown
Member

/backport to release/10.0.4xx

@akoeplinger

Copy link
Copy Markdown
Member

/backport to release/10.0.1xx

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/10.0.1xx (link to workflow run)

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/10.0.4xx (link to workflow run)

@github-actions

Copy link
Copy Markdown
Contributor

@akoeplinger backporting to release/10.0.1xx failed, the patch most likely resulted in conflicts. Please backport manually!

git am output
$ git cherry-pick 0b5109c67228e2566ba35f47607106f97e62cc8a

Auto-merging Directory.Build.props
Auto-merging eng/tools/BinaryToolKit/BinaryToolKit.csproj
Auto-merging eng/tools/tasks/Microsoft.DotNet.UnifiedBuild.MSBuildSdkResolver/Microsoft.DotNet.UnifiedBuild.MSBuildSdkResolver.csproj
Auto-merging eng/tools/tasks/Microsoft.DotNet.UnifiedBuild.Tasks/Microsoft.DotNet.UnifiedBuild.Tasks.csproj
CONFLICT (content): Merge conflict in eng/tools/tasks/Microsoft.DotNet.UnifiedBuild.Tasks/Microsoft.DotNet.UnifiedBuild.Tasks.csproj
Auto-merging repo-projects/Directory.Build.props
Auto-merging repo-projects/Directory.Build.targets
Auto-merging src/fsharp/eng/Build.ps1
Auto-merging src/fsharp/eng/build.sh
Auto-merging src/roslyn/eng/build.ps1
Auto-merging src/roslyn/eng/build.sh
Auto-merging src/runtime/eng/build.ps1
error: could not apply 0b5109c6722... Downgrade NU1901, NU1902, NU1903 to warnings and log them (#7922)
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
hint: Disable this message with "git config set advice.mergeConflict false"


$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: Downgrade NU1901-4 to warnings and log them
Applying: Accept /clp msbuild arg in roslyn and fsharp scripts
Applying: Add warning suppression for specific NuGet warnings
Applying: Fix warn as error flag
Applying: Add empty D.B.rsp
Applying: Fix warning logging by using custom task to read warnings
.git/rebase-apply/patch:205: trailing whitespace.
      warnings stay warnings instead of being promoted to errors by the blanket -warnAsError. 
warning: 1 line adds whitespace errors.
Using index info to reconstruct a base tree...
M	Directory.Build.props
M	eng/tools/BinaryToolKit/BinaryToolKit.csproj
M	eng/tools/tasks/Microsoft.DotNet.UnifiedBuild.MSBuildSdkResolver/Microsoft.DotNet.UnifiedBuild.MSBuildSdkResolver.csproj
M	eng/tools/tasks/Microsoft.DotNet.UnifiedBuild.Tasks/Microsoft.DotNet.UnifiedBuild.Tasks.csproj
M	repo-projects/Directory.Build.props
M	repo-projects/Directory.Build.targets
M	src/runtime/eng/build.ps1
Falling back to patching base and 3-way merge...
Auto-merging Directory.Build.props
Auto-merging eng/tools/BinaryToolKit/BinaryToolKit.csproj
Auto-merging eng/tools/tasks/Microsoft.DotNet.UnifiedBuild.MSBuildSdkResolver/Microsoft.DotNet.UnifiedBuild.MSBuildSdkResolver.csproj
Auto-merging eng/tools/tasks/Microsoft.DotNet.UnifiedBuild.Tasks/Microsoft.DotNet.UnifiedBuild.Tasks.csproj
CONFLICT (content): Merge conflict in eng/tools/tasks/Microsoft.DotNet.UnifiedBuild.Tasks/Microsoft.DotNet.UnifiedBuild.Tasks.csproj
Auto-merging repo-projects/Directory.Build.props
Auto-merging repo-projects/Directory.Build.targets
Auto-merging src/runtime/eng/build.ps1
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0006 Fix warning logging by using custom task to read warnings
Error: The process '/usr/bin/git' failed with exit code 128

Link to workflow output

@github-actions

Copy link
Copy Markdown
Contributor

@akoeplinger backporting to release/10.0.4xx failed, the patch most likely resulted in conflicts. Please backport manually!

git am output
$ git cherry-pick 0b5109c67228e2566ba35f47607106f97e62cc8a

Auto-merging Directory.Build.props
Auto-merging eng/tools/BinaryToolKit/BinaryToolKit.csproj
Auto-merging eng/tools/tasks/Microsoft.DotNet.UnifiedBuild.MSBuildSdkResolver/Microsoft.DotNet.UnifiedBuild.MSBuildSdkResolver.csproj
Auto-merging eng/tools/tasks/Microsoft.DotNet.UnifiedBuild.Tasks/Microsoft.DotNet.UnifiedBuild.Tasks.csproj
CONFLICT (content): Merge conflict in eng/tools/tasks/Microsoft.DotNet.UnifiedBuild.Tasks/Microsoft.DotNet.UnifiedBuild.Tasks.csproj
Auto-merging repo-projects/Directory.Build.props
Auto-merging repo-projects/Directory.Build.targets
CONFLICT (modify/delete): src/runtime/eng/build.ps1 deleted in HEAD and modified in 0b5109c6722 (Downgrade NU1901, NU1902, NU1903 to warnings and log them (#7922)).  Version 0b5109c6722 (Downgrade NU1901, NU1902, NU1903 to warnings and log them (#7922)) of src/runtime/eng/build.ps1 left in tree.
error: could not apply 0b5109c6722... Downgrade NU1901, NU1902, NU1903 to warnings and log them (#7922)
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
hint: Disable this message with "git config set advice.mergeConflict false"


$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: Downgrade NU1901-4 to warnings and log them
Applying: Accept /clp msbuild arg in roslyn and fsharp scripts
Applying: Add warning suppression for specific NuGet warnings
Applying: Fix warn as error flag
Applying: Add empty D.B.rsp
Applying: Fix warning logging by using custom task to read warnings
.git/rebase-apply/patch:205: trailing whitespace.
      warnings stay warnings instead of being promoted to errors by the blanket -warnAsError. 
warning: 1 line adds whitespace errors.
Using index info to reconstruct a base tree...
M	Directory.Build.props
M	eng/tools/BinaryToolKit/BinaryToolKit.csproj
M	eng/tools/tasks/Microsoft.DotNet.UnifiedBuild.MSBuildSdkResolver/Microsoft.DotNet.UnifiedBuild.MSBuildSdkResolver.csproj
M	eng/tools/tasks/Microsoft.DotNet.UnifiedBuild.Tasks/Microsoft.DotNet.UnifiedBuild.Tasks.csproj
M	repo-projects/Directory.Build.props
M	repo-projects/Directory.Build.targets
A	src/runtime/eng/build.ps1
Falling back to patching base and 3-way merge...
Auto-merging Directory.Build.props
Auto-merging eng/tools/BinaryToolKit/BinaryToolKit.csproj
Auto-merging eng/tools/tasks/Microsoft.DotNet.UnifiedBuild.MSBuildSdkResolver/Microsoft.DotNet.UnifiedBuild.MSBuildSdkResolver.csproj
Auto-merging eng/tools/tasks/Microsoft.DotNet.UnifiedBuild.Tasks/Microsoft.DotNet.UnifiedBuild.Tasks.csproj
CONFLICT (content): Merge conflict in eng/tools/tasks/Microsoft.DotNet.UnifiedBuild.Tasks/Microsoft.DotNet.UnifiedBuild.Tasks.csproj
Auto-merging repo-projects/Directory.Build.props
Auto-merging repo-projects/Directory.Build.targets
CONFLICT (modify/delete): src/runtime/eng/build.ps1 deleted in HEAD and modified in Fix warning logging by using custom task to read warnings.  Version Fix warning logging by using custom task to read warnings of src/runtime/eng/build.ps1 left in tree.
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0006 Fix warning logging by using custom task to read warnings
Error: The process '/usr/bin/git' failed with exit code 128

Link to workflow output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants