diff --git a/csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependencyManager.cs b/csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependencyManager.cs index 724ae8f69fda..f4ae77c3d338 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependencyManager.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependencyManager.cs @@ -924,6 +924,18 @@ private void DownloadMissingPackages(List allFiles, ISet dllPa return; } + var multipleVersions = notYetDownloadedPackages + .GroupBy(p => p.Name) + .Where(g => g.Count() > 1) + .Select(g => g.Key) + .ToList(); + + foreach (var package in multipleVersions) + { + logger.LogWarning($"Found multiple not yet restored packages with name '{package}'."); + notYetDownloadedPackages.Remove(new(package, PackageReferenceSource.PackagesConfig)); + } + logger.LogInfo($"Found {notYetDownloadedPackages.Count} packages that are not yet restored"); var nugetConfigs = allFiles.SelectFileNamesByName("nuget.config").ToArray();