Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Append in DependencyResolver. #21

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 2 additions & 22 deletions src/Core/DependencyResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
}
}
Expand Down