Skip to content

Commit a496e08

Browse files
committed
Filter out legacy and resources dlls
1 parent 8213838 commit a496e08

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Runner/Helpers/NuGetClient.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,11 +366,13 @@ static bool IsPermissive(NuGetLicenseExpression expression)
366366
string expectedDll = $"{id}.dll";
367367
var dlls = group.Items
368368
.Where(i => i.EndsWith(".dll", StringComparison.OrdinalIgnoreCase))
369+
.Where(i => !IsSatelliteOrLegacyAssembly(i))
369370
.ToList();
370371

371372
// Prefer the DLL matching the package name, fall back if there's exactly one DLL in the group.
372373
string? entry = dlls.FirstOrDefault(i => Path.GetFileName(i).Equals(expectedDll, StringComparison.OrdinalIgnoreCase))
373374
?? (dlls.Count == 1 ? dlls[0] : null);
375+
374376
if (entry is null)
375377
return (null, group.TargetFramework.GetShortFolderName());
376378

@@ -494,6 +496,13 @@ private static void ExtractEntry(PackageArchiveReader reader, string entry, stri
494496
entryStream.CopyTo(fs);
495497
}
496498

499+
private static bool IsSatelliteOrLegacyAssembly(string path)
500+
{
501+
ReadOnlySpan<char> fileName = Path.GetFileName(path.AsSpan());
502+
return fileName.EndsWith(".resources.dll", StringComparison.OrdinalIgnoreCase)
503+
|| fileName.EndsWith(".legacy.dll", StringComparison.OrdinalIgnoreCase);
504+
}
505+
497506
private static bool IsManagedAssembly(string path)
498507
{
499508
try

0 commit comments

Comments
 (0)