Repository navigation
[repo-assist] Forward NoWarn/TreatWarningsAsErrors/WarningsAsErrors to PackTask - #4393
Merged
dsyme merged 1 commit intoAug 29, 2026
Merged
Conversation
…est MSBuild pack path Closes #3504 Root cause: Paket.Restore.targets invokes the MSBuild PackTask (via UseMSBuild16_10_Pack) without forwarding NoWarn, TreatWarningsAsErrors, or WarningsAsErrors, even though the underlying NuGet PackTask.cs has supported these parameters since NuGet.Client 4.7+. As a result, warnings like NU5105 (SemVer 2.0 version string) could not be suppressed via NoWarn when running 'dotnet pack' through Paket-managed restore/pack targets. Fix: forward $(NoWarn), $(TreatWarningsAsErrors), and $(WarningsAsErrors) MSBuild properties to the PackTask invocation guarded by UseMSBuild16_10_Pack (the modern, actively used pack path). Older/legacy PackTask invocations (UseMSBuild16_0_Pack, UseMSBuild15_9_Pack, UseMSBuild15_8_Pack, UseNuGet4_Pack) predate this NuGet.Client support and are left unchanged to avoid passing unsupported parameters. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Aug 29, 2026
dsyme
marked this pull request as ready for review
August 29, 2026 12:11
This was referenced Oct 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This is an automated pull request from Repo Assist, an AI assistant.
Closes #3504
Root cause
Paket.Restore.targetsinvokes MSBuild'sPackTaskfordotnet packbut never forwards theNoWarn,TreatWarningsAsErrors, orWarningsAsErrorsproperties, even though NuGet'sPackTask.cshas exposed these parameters since NuGet.Client 4.7 (NuGet/NuGet.Client#2013). Consequently, warnings such asNU5105(SemVer 2.0 pre-release version string) could not be suppressed viaNoWarnwhen packing through Paket.Fix
Forward
$(NoWarn),$(TreatWarningsAsErrors), and$(WarningsAsErrors)MSBuild properties to thePackTaskinvocation guarded byUseMSBuild16_10_Pack— the current, actively used pack path for modern MSBuild/SDK versions. The older legacyPackTaskinvocations (UseMSBuild16_0_Pack,UseMSBuild15_9_Pack,UseMSBuild15_8_Pack,UseNuGet4_Pack) predate this NuGet.Client support and are intentionally left unchanged, matching the issue reporter's own caution about not blindly passing these to versions that may not support them.Trade-offs
Test Status
Paket.Restore.targetsis well-formed XML (xml.dom.minidomparse succeeded).dotnet build/pack integration test in this sandbox becausedotnet paket restorerequires network access to NuGet feeds that isn't available here. No existing automated integration test scenario coversdotnet packwarning suppression, so none could be extended without adding new test infrastructure, which is out of scope for this minimal fix.NoWarn/TreatWarningsAsErrors/WarningsAsErrors.Please review CI results after this PR is opened to confirm no regressions in the existing Windows/.NET and Linux build+test suites.
Add this agentic workflow to your repo
To install this agentic workflow, run