Don't return if no volatile feeds are found.
This commit is contained in:
parent
53eb708a8b
commit
03266b4b2a
|
|
@ -10,27 +10,25 @@ use namespace="System.Xml.Linq"
|
||||||
.Select(entry => new KeyValuePair<string, string>(((string)entry.Key).Substring(prefix.Length), (string)entry.Value))
|
.Select(entry => new KeyValuePair<string, string>(((string)entry.Key).Substring(prefix.Length), (string)entry.Value))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
if (!feeds.Any())
|
if (feeds.Any())
|
||||||
{
|
{
|
||||||
return;
|
var nugetConfig = XDocument.Load("NuGet.config");
|
||||||
}
|
var packageSources = nugetConfig.Element("configuration").Element("packageSources");
|
||||||
|
var addElements = packageSources.Elements("add").ToList();
|
||||||
var nugetConfig = XDocument.Load("NuGet.config");
|
foreach (var feed in feeds)
|
||||||
var packageSources = nugetConfig.Element("configuration").Element("packageSources");
|
|
||||||
var addElements = packageSources.Elements("add").ToList();
|
|
||||||
foreach (var feed in feeds)
|
|
||||||
{
|
|
||||||
var valueToUpdate = addElements.FirstOrDefault(f => string.Equals(f.Attribute("key").Value, feed.Key, StringComparison.OrdinalIgnoreCase));
|
|
||||||
if (valueToUpdate == null)
|
|
||||||
{
|
{
|
||||||
packageSources.Add(new XElement("add", new XAttribute("key", feed.Key), new XAttribute("value", feed.Value)));
|
var valueToUpdate = addElements.FirstOrDefault(f => string.Equals(f.Attribute("key").Value, feed.Key, StringComparison.OrdinalIgnoreCase));
|
||||||
}
|
if (valueToUpdate == null)
|
||||||
else
|
{
|
||||||
{
|
packageSources.Add(new XElement("add", new XAttribute("key", feed.Key), new XAttribute("value", feed.Value)));
|
||||||
valueToUpdate.Attribute("value").Value = feed.Value;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
valueToUpdate.Attribute("value").Value = feed.Value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nugetConfig.Save("NuGet.config");
|
||||||
}
|
}
|
||||||
|
|
||||||
nugetConfig.Save("NuGet.config");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,27 +10,25 @@ use namespace="System.Xml.Linq"
|
||||||
.Select(entry => new KeyValuePair<string, string>(((string)entry.Key).Substring(prefix.Length), (string)entry.Value))
|
.Select(entry => new KeyValuePair<string, string>(((string)entry.Key).Substring(prefix.Length), (string)entry.Value))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
if (!feeds.Any())
|
if (feeds.Any())
|
||||||
{
|
{
|
||||||
return;
|
var nugetConfig = XDocument.Load("NuGet.config");
|
||||||
}
|
var packageSources = nugetConfig.Element("configuration").Element("packageSources");
|
||||||
|
var addElements = packageSources.Elements("add").ToList();
|
||||||
var nugetConfig = XDocument.Load("NuGet.config");
|
foreach (var feed in feeds)
|
||||||
var packageSources = nugetConfig.Element("configuration").Element("packageSources");
|
|
||||||
var addElements = packageSources.Elements("add").ToList();
|
|
||||||
foreach (var feed in feeds)
|
|
||||||
{
|
|
||||||
var valueToUpdate = addElements.FirstOrDefault(f => string.Equals(f.Attribute("key").Value, feed.Key, StringComparison.OrdinalIgnoreCase));
|
|
||||||
if (valueToUpdate == null)
|
|
||||||
{
|
{
|
||||||
packageSources.Add(new XElement("add", new XAttribute("key", feed.Key), new XAttribute("value", feed.Value)));
|
var valueToUpdate = addElements.FirstOrDefault(f => string.Equals(f.Attribute("key").Value, feed.Key, StringComparison.OrdinalIgnoreCase));
|
||||||
}
|
if (valueToUpdate == null)
|
||||||
else
|
{
|
||||||
{
|
packageSources.Add(new XElement("add", new XAttribute("key", feed.Key), new XAttribute("value", feed.Value)));
|
||||||
valueToUpdate.Attribute("value").Value = feed.Value;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
valueToUpdate.Attribute("value").Value = feed.Value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nugetConfig.Save("NuGet.config");
|
||||||
}
|
}
|
||||||
|
|
||||||
nugetConfig.Save("NuGet.config");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue