Removing nodes from an XmlDocument

Instead of

configDoc.RemoveChild(projectNodes[i]);

try

projectNodes[i].parentNode.RemoveChild(projectNodes[i]);

try

configDoc.DocumentElement.RemoveChild(projectNodes[i]);