From 4c61c241d6b43532595e22281464303ae8ea701b Mon Sep 17 00:00:00 2001 From: enisn Date: Fri, 11 Oct 2024 11:11:30 +0300 Subject: [PATCH] Don't create PackageSourceMapping if there is none --- .../ProjectModification/PackageSourceManager.cs | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackageSourceManager.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackageSourceManager.cs index e4daa30838..d43c63aa54 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackageSourceManager.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackageSourceManager.cs @@ -79,21 +79,7 @@ public class PackageSourceManager : ITransientDependency { var packageMappingNodes = doc.SelectNodes("/configuration/packageSourceMapping"); - if (packageMappingNodes == null || packageMappingNodes.Count == 0) - { - var packageSourcesNode = doc.SelectSingleNode("/configuration/packageSources"); - var packageMappingNode = doc.CreateElement("packageSourceMapping"); - foreach (var pattern in packageMappingPatterns) - { - var patternNode = doc.CreateElement("packageSource"); - var patternAttr = doc.CreateAttribute("key"); - patternAttr.Value = pattern; - patternNode.Attributes.Append(patternAttr); - packageMappingNode.AppendChild(patternNode); - } - packageSourcesNode?.ParentNode?.InsertAfter(packageMappingNode, packageSourcesNode); - } - else + if (packageMappingNodes != null && packageMappingNodes.Count != 0) { var packageSourceNode = doc.CreateElement("packageSource"); var sourceAttr = doc.CreateAttribute("key"); @@ -109,6 +95,7 @@ public class PackageSourceManager : ITransientDependency packageSourceNode.AppendChild(packageNode); } } + // If there is no packageSourceMapping node, leave it as it is. } public void Remove(string solutionFolder, string sourceKey)