Add test to detect CPM conflicts with implicit PackageReferences#16609
Merged
lewing merged 1 commit intodotnet:mainfrom Mar 19, 2026
Merged
Add test to detect CPM conflicts with implicit PackageReferences#16609lewing merged 1 commit intodotnet:mainfrom
lewing merged 1 commit intodotnet:mainfrom
Conversation
3 tasks
There was a problem hiding this comment.
Pull request overview
Adds an Arcade SDK unit test to prevent NuGet Central Package Management (CPM) conflicts where an implicitly defined PackageReference (e.g., IsImplicitlyDefined="true" in Arcade .targets/.props) also has a PackageVersion entry in Directory.Packages.props, which can trigger NU1009.
Changes:
- Introduces
CentralPackageManagementTeststo scan Arcade SDK toolset.targets/.propsfiles for implicitly definedPackageReferenceitems. - Loads
Directory.Packages.propsand asserts there are no overlapping package IDs between implicit references andPackageVersionentries. - Adds repo-root discovery logic to locate
Directory.Packages.propsand the Arcade SDK toolset directory.
You can also share your feedback on Copilot code review. Take the survey.
src/Microsoft.DotNet.Arcade.Sdk.Tests/CentralPackageManagementTests.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.Arcade.Sdk.Tests/CentralPackageManagementTests.cs
Outdated
Show resolved
Hide resolved
4815c8d to
d75885e
Compare
mmitche
previously approved these changes
Mar 19, 2026
Validates that implicitly defined PackageReferences in Arcade SDK .targets files (IsImplicitlyDefined=true) do not have corresponding PackageVersion entries in Directory.Packages.props. Such conflicts cause NU1009 errors under NuGet's Central Package Management rules. This would have caught the conflict introduced in dotnet#16555 where xunit.v3.core was added to Directory.Packages.props while also being implicitly defined in XUnitV3.targets. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
376ed1d to
ba6bdcd
Compare
steveisok
approved these changes
Mar 19, 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.
Adds a test that validates implicitly defined
PackageReferenceitems in Arcade SDK.targetsfiles (IsImplicitlyDefined="true") do not have correspondingPackageVersionentries inDirectory.Packages.props.Such conflicts cause NU1009 errors under NuGet's Central Package Management rules. This test would have caught the conflict introduced in #16555 (where
xunit.v3.corewas added toDirectory.Packages.propswhile also being implicitly defined inXUnitV3.targets), which broke the VMR rebootstrap build in dotnet/dotnet#5578.Fixed by #16608.
/cc @steveisok @mmitche