C#: Make the assembly lookup case insensitive on the dll file extension and log if no dlls are found in a directory.

This commit is contained in:
Michael Nebel
2024-04-09 13:01:20 +02:00
parent 9eb13833fa
commit 99f0ed26e9

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Semmle.Util.Logging;
namespace Semmle.Extraction.CSharp.DependencyFetching
@@ -25,7 +26,13 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
/// <param name="dir">The directory to index.</param>
private void AddReferenceDirectory(List<string> dllsToIndex, ILogger logger)
{
foreach (var dll in new DirectoryInfo(p).EnumerateFiles("*.dll", SearchOption.AllDirectories))
var dlls = new DirectoryInfo(p).EnumerateFiles("*.dll", new EnumerationOptions { RecurseSubdirectories = true, MatchCasing = MatchCasing.CaseInsensitive, AttributesToSkip = FileAttributes.None });
if (!dlls.Any())
{
logger.LogWarning($"AssemblyLookupLocation: No DLLs found in the path '{p}'.");
return;
}
foreach (var dll in dlls)
{
if (includeFileName(dll.Name))
{