Skip to content

Commit 7333b38

Browse files
committed
Add clear tag to AddSourceToNuGetConfig
1 parent 7259e28 commit 7333b38

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tools-local/tasks/Microsoft.DotNet.SourceBuild.Tasks/AddSourceToNuGetConfig.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public override bool Execute()
3333
XDocument d = XDocument.Load(NuGetConfigFile);
3434
XElement packageSourcesElement = d.Root.Descendants().First(e => e.Name == "packageSources");
3535
XElement toAdd = new XElement("add", new XAttribute("key", SourceName), new XAttribute("value", SourcePath));
36+
XElement clearTag = new XElement("clear");
3637

3738
XElement exisitingSourceBuildElement = packageSourcesElement.Descendants().FirstOrDefault(e => e.Name == "add" && e.Attribute(XName.Get("key")).Value == SourceName);
3839
XElement lastClearElement = packageSourcesElement.Descendants().LastOrDefault(e => e.Name == "clear");
@@ -48,6 +49,7 @@ public override bool Execute()
4849
else
4950
{
5051
packageSourcesElement.AddFirst(toAdd);
52+
packageSourcesElement.AddFirst(clearTag);
5153
}
5254

5355
using (FileStream fs = new FileStream(NuGetConfigFile, FileMode.Create, FileAccess.ReadWrite))

0 commit comments

Comments
 (0)