Skip to content

Commit

Permalink
Properly use all matches
Browse files Browse the repository at this point in the history
  • Loading branch information
sensslen committed Sep 18, 2024
1 parent 6eaa0a9 commit 8e0de48
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,16 @@ private bool TryGetInstalledPackagesFromAssetsFile(bool includeTransitive,

if (targetFramework is not null)
{
ILockFileTarget target = (assetsFile.Targets?.FirstOrDefault(t => t.TargetFramework.Equals(targetFramework))) ??
IEnumerable<ILockFileTarget> matchingTargets = assetsFile.Targets!.Where(t => t.TargetFramework.Equals(targetFramework));
if (!matchingTargets.Any())
{
throw new ReferencedPackageReaderException($"Target framework {targetFramework} not found.");
}

referencedLibraries.AddRange(GetReferencedLibrariesForTarget(includeTransitive, assetsFile, target));
foreach (ILockFileTarget target in matchingTargets)
{
referencedLibraries.AddRange(GetReferencedLibrariesForTarget(includeTransitive, assetsFile, target));
}
}
else
{
Expand Down

0 comments on commit 8e0de48

Please sign in to comment.