Skip to content

Commit

Permalink
Consider both framework name and version
Browse files Browse the repository at this point in the history
  • Loading branch information
sharwell committed Apr 8, 2024
1 parent 9524cd7 commit d3b9acc
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ await PackageExtractor.ExtractPackageAsync(
var assembliesToRemove = new List<string>();
foreach (var assemblyNameGroup in assembliesByName)
{
var assembliesByPrecedence = assemblyNameGroup.OrderBy(GetFrameworkNameFromPath, comparer).ToArray();
var assembliesByPrecedence = assemblyNameGroup.OrderBy(GetFrameworkNameFromPath, comparer).ThenByDescending(GetFrameworkNameFromPath, new NuGetFrameworkSorter()).ToArray();
for (var i = 1; i < assembliesByPrecedence.Length; i++)
{
// We want to keep the last reference listed for the most recent supported target framework.
Expand All @@ -482,7 +482,7 @@ await PackageExtractor.ExtractPackageAsync(
// In this example, the Microsoft.NETCore.App.Ref package is resolved first, so by taking
// the last net6.0 assembly, we ensure the assembly from System.Collections.Immutable 8.0.0
// is resolved.
if (comparer.Compare(GetFrameworkNameFromPath(assembliesByPrecedence[0]), GetFrameworkNameFromPath(assembliesByPrecedence[i])) == 0)
if (Equals(GetFrameworkNameFromPath(assembliesByPrecedence[0]), GetFrameworkNameFromPath(assembliesByPrecedence[i])))
{
assembliesToRemove.Add(assembliesByPrecedence[i - 1]);
}
Expand Down

0 comments on commit d3b9acc

Please sign in to comment.