Allow NuGet dependencies to exist with duplicate names but different dependency types #9642
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.
NuGetUpdater.Cli.exe discover
was throwing "An item with teh same key has already been added" in the situation where a centrally-managed Directory.Build.props file would have 2 references for the same package based on a condition such as the repository using central package management.This is an example that would make the tool throw from my company's centrally-managed Directory.Build.props file:
If central package management is enabled, then our company-managed Roslyn analyzers package is included as a
GlobalPackageReference
. If not, it's added to the project as a regularPackageReference
.But the duplicate name caused a problem with the discover code tried to do
.ToDictionary(…)
on the name alone, so this change uses a lookup to allow multiple values.A test has been added that demonstrates the desired result.