Skip to content

Commit

Permalink
Revert "fix: handling of empty packages sequence"
Browse files Browse the repository at this point in the history
This reverts commit 8b6cf7e.
  • Loading branch information
cslong committed Feb 22, 2024
1 parent 764c5b3 commit 3eaab8c
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/CTA.Rules.ProjectFile/ProjectFileCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -295,15 +295,11 @@ private void UpdatePackageReferences()
.GroupBy(d => d.Name).Select(d => d.FirstOrDefault())
.ToDictionary(p => p.Name, p => p.Version);

// if packages is empty, or every key in _packages is contained in existing packages, return
if (_packages.Count == 0 ||
_packages.All(p => existingPackages.Keys?.Contains(p.Key) ?? true))
{
return;
}

_packages = _packages.Where(p => existingPackages.Keys?.Contains(p.Key) == false).ToDictionary(d => d.Key, d => d.Value);

//No packages to add
if (_packages.Count == 0) return;

var packages = GetPackagesSection();
if (existingPackages.Count == 0)
{
Expand Down

0 comments on commit 3eaab8c

Please sign in to comment.