добавить XmlElemnt в csproj файл из другого файла:Удалить Xmlns = «» атрибут при добавлении элемента из файла
//load the orginal file
XmlDocument xd = new XmlDocument();
xd.Load(fileName);
//load the csproj file to setting
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(project.FullName);
//copy a XmlNode from the orginal file
XmlNode copiedNode = xmlDoc.ImportNode(xd.SelectSingleNode(nodeName), true);
//add the XmlNode to the csproj file
xmlDoc.DocumentElement.InsertAfter(copiedNode,xmlDoc.GetElementsByTagName(nodeName).Item(0));
и исходный код автоматически добавляются в атрибут Xmlns = «» к добавленному узлу:
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'AAA|x86'" xmlns="">
Я вижу аналогичную проблему в публикации: Remove xmlns=“” attribute when adding Reference element into csproj. Решение состоит в том, чтобы добавить пространство имен, но я не могу найти, как добавить пространство имен в мой код.
Как я могу это сделать? Или - Есть ли другой способ избежать добавления атрибута xmlns?