Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
using System.IO;
using System.Linq;
using System.Xml.Linq;
using Microsoft.Build.Utilities;
public class RemoveRuntimeNode : Task
public string ConfigFilePath { get; set; }
public override bool Execute()
var doc = XDocument.Load(this.ConfigFilePath);
if (doc == null) return false;
doc.Root.Nodes().OfType<XElement>().FirstOrDefault(e => e.Name.LocalName == "runtime")?.Remove();
using (var stream = new StreamWriter(this.ConfigFilePath))
return true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.