Browse Source

Add logs when there is no update on packageMapping

pull/21049/head
enisn 1 year ago
parent
commit
aa78c49cb8
No known key found for this signature in database GPG Key ID: A052619F04155D1C
  1. 32
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackageSourceManager.cs

32
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackageSourceManager.cs

@ -79,23 +79,25 @@ public class PackageSourceManager : ITransientDependency
{
var packageMappingNodes = doc.SelectNodes("/configuration/packageSourceMapping");
if (packageMappingNodes != null && packageMappingNodes.Count != 0)
if (packageMappingNodes == null)
{
var packageSourceNode = doc.CreateElement("packageSource");
var sourceAttr = doc.CreateAttribute("key");
sourceAttr.Value = sourceKey;
packageSourceNode.Attributes.Append(sourceAttr);
packageMappingNodes[0]?.AppendChild(packageSourceNode);
foreach (var pattern in packageMappingPatterns)
{
var packageNode = doc.CreateElement("package");
var patternAttr = doc.CreateAttribute("pattern");
patternAttr.Value = pattern;
packageNode.Attributes.Append(patternAttr);
packageSourceNode.AppendChild(packageNode);
}
// If there is no packageSourceMapping node, leave it as it is.
Logger.LogWarning($"<packageSourceMapping> node not found in 'NuGet.Config' file. Skipping adding patterns for '{sourceKey}' source.");
return;
}
var packageSourceNode = doc.CreateElement("packageSource");
var sourceAttr = doc.CreateAttribute("key");
sourceAttr.Value = sourceKey;
packageSourceNode.Attributes.Append(sourceAttr);
packageMappingNodes[0]?.AppendChild(packageSourceNode);
foreach (var pattern in packageMappingPatterns)
{
var packageNode = doc.CreateElement("package");
var patternAttr = doc.CreateAttribute("pattern");
patternAttr.Value = pattern;
packageNode.Attributes.Append(patternAttr);
packageSourceNode.AppendChild(packageNode);
}
// If there is no packageSourceMapping node, leave it as it is.
}
public void Remove(string solutionFolder, string sourceKey)

Loading…
Cancel
Save