Repository navigation
🐛 Pinned-Dependencies: keep scanning Directory.*.props until central package management is found - #5348
Open
jeffersonnlucas wants to merge 1 commit into
Open
🐛 Pinned-Dependencies: keep scanning Directory.*.props until central package management is found#5348jeffersonnlucas wants to merge 1 commit into
jeffersonnlucas wants to merge 1 commit into
Conversation
…package management is found processDirectoryPropsFile stored the first well-formed Directory.*.props and stopped iterating, even when that file did not enable central package management. In the layout the NuGet docs recommend, Directory.Build.props (build settings, no CPM) sorts before Directory.Packages.props, so CPM was never detected and every nuget restore command was reported unpinned with the generic remediation. Keep iterating while the file does not enable CPM, so Directory.Packages.props is reached. Signed-off-by: Jeffersonn Barboza <jeffersonnlucas@gmail.com>
jeffersonnlucas
requested review from
justaugustus and
spencerschrock
and removed request for
a team
October 19, 2026 15:26
This branch has not been deployed
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.
What kind of change does this PR introduce?
Bug fix.
What is the current behavior?
processDirectoryPropsFilestores the first well-formedDirectory.*.propsit sees and returnsfalse(stop iterating), regardless of whether that file enables central package management.In the layout the NuGet docs recommend, a repository has both
Directory.Build.props(shared build settings, noManagePackageVersionsCentrally) andDirectory.Packages.props(CPM). Both matchDirectory.*.props, andDirectory.Build.propsis listed first by the tarball handler and byfilepath.Walkin the local client. The check therefore recordsIsCPMEnabled: false, falls back to the per-csprojRestoreLockedModepath, and reports everydotnet restore/nuget restoreas unpinned with the generic remediation, even when everyPackageVersionis fixed.Observed on https://scorecard.dev/viewer/?uri=github.com/aedis-build/aedis-dotnet (root
Directory.Build.props+Directory.Packages.propswith CPM enabled):nugetCommand not pinned by hash ... enabling central package management ...for all three restore commands.What is the new behavior (if this is a feature change)?
While the parsed file does not enable CPM, keep iterating so
Directory.Packages.propsis reached. The first file that enables CPM is still the one used, as before.TestProcessDirectoryPropsFileKeepsSearchingUntilCPMIsEnabledfeeds a props file without CPM followed by one with CPM, using the existing testdata; it fails onmainand passes with this change.TestAnalyseCentralPackageManagementPinnedis unchanged and still passes (a file without CPM now leavesCpmConfigat its zero value, which the test already expects).Which issue(s) this PR fixes
Fixes #5349
Special notes for your reviewer
Not covered here, on purpose: repositories with several
Directory.Packages.props(one per sub-tree) still only use the first one found. That is the pre-existing behavior and a separate change.Does this PR introduce a user-facing change?