Skip to content

Add test to detect CPM conflicts with implicit PackageReferences#16609

Merged
lewing merged 1 commit intodotnet:mainfrom
lewing:fix/cpm-validation-test
Mar 19, 2026
Merged

Add test to detect CPM conflicts with implicit PackageReferences#16609
lewing merged 1 commit intodotnet:mainfrom
lewing:fix/cpm-validation-test

Conversation

@lewing
Copy link
Copy Markdown
Member

@lewing lewing commented Mar 18, 2026

Adds a test that validates implicitly defined PackageReference items 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 test would have caught the conflict introduced in #16555 (where xunit.v3.core was added to Directory.Packages.props while also being implicitly defined in XUnitV3.targets), which broke the VMR rebootstrap build in dotnet/dotnet#5578.

Fixed by #16608.

Note: This test will fail on current main until #16608 merges. It should be merged after or together with that fix.

/cc @steveisok @mmitche

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 CentralPackageManagementTests to scan Arcade SDK toolset .targets/.props files for implicitly defined PackageReference items.
  • Loads Directory.Packages.props and asserts there are no overlapping package IDs between implicit references and PackageVersion entries.
  • Adds repo-root discovery logic to locate Directory.Packages.props and the Arcade SDK toolset directory.

You can also share your feedback on Copilot code review. Take the survey.

@lewing lewing force-pushed the fix/cpm-validation-test branch 2 times, most recently from 4815c8d to d75885e Compare March 19, 2026 04:01
mmitche
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>
@lewing lewing force-pushed the fix/cpm-validation-test branch from 376ed1d to ba6bdcd Compare March 19, 2026 18:34
@steveisok steveisok self-requested a review March 19, 2026 18:35
@lewing lewing enabled auto-merge (squash) March 19, 2026 18:41
@lewing lewing merged commit edfa48e into dotnet:main Mar 19, 2026
8 of 9 checks passed
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