Skip to content

Properly handle duplicate central package version items in the restore graph when using custom build ordering in a solution file - #4776

Merged
jeffkl merged 2 commits into
devfrom
dev-jeffkl-handle-duplicate-centralpackageversions
Sep 1, 2022
Merged

jeffkl merged 2 commits into
devfrom
dev-jeffkl-handle-duplicate-centralpackageversions

Conversation

@jeffkl

@jeffkl jeffkl commented Aug 30, 2022 •

Copy link
Copy Markdown
Contributor

Bug

Fixes: NuGet/Home#12021

Regression? Last working version:

Description

When a user specified custom build ordering in a solution file, MSBuild generates a ProjectReference on the fly. If a user still has an actual ProjectReference in a project, NuGet will get the PackageReference and PackageVersions items twice with duplicates in the restore graph.

This updates the logic to handle duplicates by implementing a last one wins strategy.

PR Checklist

  • PR has a meaningful title

  • PR has a linked issue.

  • Described changes

  • Tests

    • Automated tests added
    • OR
    • Test exception
    • OR
    • N/A
  • Documentation

    • Documentation PR or issue filled
    • OR
    • N/A

@jeffkl
jeffkl requested a review from a team as a code owner August 30, 2022 16:10
@jeffkl jeffkl changed the title Properly handle duplicate central package versions during restore Properly handle duplicate central package version items in the restore graph when using custom build ordering in a solution file Aug 30, 2022
@jeffkl
jeffkl requested a review from nkolev92 August 31, 2022 19:28
nkolev92
nkolev92 previously approved these changes Aug 31, 2022
@jeffkl
jeffkl force-pushed the dev-jeffkl-handle-duplicate-centralpackageversions branch from 5acf8a1 to 3906a1c Compare August 31, 2022 21:54
@jeffkl
jeffkl force-pushed the dev-jeffkl-handle-duplicate-centralpackageversions branch from 3906a1c to c7f47b7 Compare August 31, 2022 21:54
@jeffkl
jeffkl requested a review from nkolev92 August 31, 2022 21:59

@nkolev92 nkolev92 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for adding that extra test!

@jeffkl
jeffkl merged commit 586d6d6 into dev Sep 1, 2022
@jeffkl
jeffkl deleted the dev-jeffkl-handle-duplicate-centralpackageversions branch September 1, 2022 15:47
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.

[Bug]: "An item with the same key has already been added" when migrating to CPM with ProjectDependencies in solution file

3 participants