Document NU1503 NuGet restore warnings on dotnet restore#47843
Open
yeelam-gordon wants to merge 1 commit into
Open
Document NU1503 NuGet restore warnings on dotnet restore#47843yeelam-gordon wants to merge 1 commit into
yeelam-gordon wants to merge 1 commit into
Conversation
Investigation findings: * 'dotnet restore PowerToys.slnx' emits 112 NU1503 warnings (one per .vcxproj that lacks PackageReference items). * 'msbuild /t:restore PowerToys.slnx' emits 0 NU1503 warnings - msbuild handles native projects through the Microsoft.Cpp SDK. * PowerToys CI and the canonical tools/build/build-essentials.cmd script already use msbuild, so the warnings are only visible to developers who run 'dotnet restore' directly. * Suppression via per-project NoWarn does not work because NU1503 is emitted at solution-level by the NuGet restore engine before per-project targets are evaluated. The pragmatic fix is documentation, advising contributors to use the script wrappers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Summary
Investigates the ~112 warnings emitted during
dotnet restoreon the PowerToys solution and documents the canonical no-warning restore path. No code/build behavior changes - documentation only.Investigation
Running
dotnet restore PowerToys.slnxproduces 112NU1503warnings of the form:warning NU1503: Skipping restore for project '...vcxproj'. The project file may be invalid or missing targets required for restore.Verified that:
NU1503and all reference.vcxprojfiles.PackageReferenceitems - thedotnet restoreengine does not know how to restore them.msbuild /t:restore PowerToys.slnx(which is whattools/build/build-essentials.cmddoes internally) emits 0 NU1503 warnings. TheMicrosoft.CppSDK handles vcxproj restore correctly.<NoWarn>NU1503</NoWarn>inDirectory.Build.propsdoes not work because NU1503 is emitted at the solution-level NuGet restore engine before per-project targets are evaluated. Tested - no reduction in warning count.<Target Name=""Restore"" />inDirectory.Build.targetsalso does not help for the same reason.Conclusion
The warnings only appear to developers who run
dotnet restoredirectly. PowerToys CI and the canonical build scripts already usemsbuildand produce a clean restore. The pragmatic and correct fix is documentation that guides contributors to the supported restore path.Change
Adds a "NuGet restore caveats" section to
tools/build/BUILD-GUIDELINES.mdexplaining:dotnet restorebut not withmsbuild /t:restore.build-essentials.cmdor directmsbuild /t:restore).Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com