Skip to content

Commit 1633673

Browse files
committed
C#: Deduplicate not yet restored package names
1 parent 35a8e7c commit 1633673

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependencyManager.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -924,6 +924,17 @@ private void DownloadMissingPackages(List<FileInfo> allFiles, ISet<string> dllPa
924924
return;
925925
}
926926

927+
var multipleVersions = notYetDownloadedPackages
928+
.GroupBy(p => p.Name)
929+
.Where(g => g.Count() > 1)
930+
.Select(g => g.Key);
931+
932+
foreach (var package in multipleVersions)
933+
{
934+
logger.LogWarning($"Found multiple not yet restored packages with name '{package}'.");
935+
notYetDownloadedPackages.Remove(new(package, PackageReferenceSource.PackagesConfig));
936+
}
937+
927938
logger.LogInfo($"Found {notYetDownloadedPackages.Count} packages that are not yet restored");
928939

929940
var nugetConfigs = allFiles.SelectFileNamesByName("nuget.config").ToArray();

0 commit comments

Comments
 (0)