C#: Also use AssemblyLookupLocation for framework dlls.

This commit is contained in:
Michael Nebel
2024-04-09 16:16:21 +02:00
parent 99f0ed26e9
commit 3b42dc25a1
2 changed files with 23 additions and 37 deletions

View File

@@ -214,29 +214,8 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
continue;
}
if (useSubfolders)
{
dllPaths.Add(path);
frameworkLocations.Add(path);
continue;
}
try
{
var dlls = Directory.GetFiles(path, "*.dll", new EnumerationOptions { RecurseSubdirectories = false, MatchCasing = MatchCasing.CaseInsensitive });
if (dlls.Length == 0)
{
logger.LogError($"No DLLs found in specified framework reference path '{path}'.");
continue;
}
dllPaths.UnionWith(dlls.Select(x => new AssemblyLookupLocation(x)));
frameworkLocations.UnionWith(dlls);
}
catch (Exception e)
{
logger.LogError($"Error while searching for DLLs in '{path}': {e.Message}");
}
dllPaths.Add(new AssemblyLookupLocation(path, _ => true, useSubfolders));
frameworkLocations.Add(path);
}
return frameworkLocations;