From a6960b86b4e715de065661dbb65fb052651ba838 Mon Sep 17 00:00:00 2001 From: "Ragnarokkr.Xia" Date: Mon, 26 Jun 2023 19:44:45 +0800 Subject: [PATCH] Fix Append in DependencyResolver. Allowing this method to append lower level dependencies. --- src/Core/DependencyResolver.cs | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/src/Core/DependencyResolver.cs b/src/Core/DependencyResolver.cs index 61c3605..546367b 100644 --- a/src/Core/DependencyResolver.cs +++ b/src/Core/DependencyResolver.cs @@ -147,18 +147,11 @@ public void ResolveByCsProj(string path) private void Append(IPackageSearchMetadata package, SourceRepository sourceRepository) { - if (_cache.PackageExists(package.Identity.Id, package.Identity.Version)) + if (!_dependencies.Any(e => e.Id == package.Identity.Id && e.Version == package.Identity.Version)) { - return; + _dependencies.Add(package.ToDependency(sourceRepository)); } - if (_dependencies.Any(e => e.Id == package.Identity.Id && e.Version == package.Identity.Version)) - { - return; - } - - _dependencies.Add(package.ToDependency(sourceRepository)); - foreach (var set in package.DependencySets) { string setTargetFramework = set.TargetFramework.ToString(); @@ -172,24 +165,11 @@ private void Append(IPackageSearchMetadata package, SourceRepository sourceRepos foreach (var dependency in set.Packages) { var minVersion = dependency.VersionRange.MinVersion; - if (_cache.PackageExists(dependency.Id, minVersion)) - { - return; - } - - if (_dependencies.Any(e => e.Id == dependency.Id && e.Version == minVersion)) - { - return; - } - (IPackageSearchMetadata dependencyPackage, SourceRepository dependencySourceRepository) = FindPackage( dependency.Id, minVersion, _options.AllowPreRelease, _options.AllowUnlisted); - - _dependencies.Add(dependencyPackage.ToDependency(dependencySourceRepository)); - Append(dependencyPackage, dependencySourceRepository); } }