diff --git a/src/CTA.Rules.ProjectFile/ProjectFileCreator.cs b/src/CTA.Rules.ProjectFile/ProjectFileCreator.cs index d648209c..f6ef7800 100644 --- a/src/CTA.Rules.ProjectFile/ProjectFileCreator.cs +++ b/src/CTA.Rules.ProjectFile/ProjectFileCreator.cs @@ -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) {