Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

msbuild xmlupdate delete node in web.config

How do I use MSBuild Community Tasks to delete a node in web.config. I can update a node using XmlUpdate task but I cannot delete a node. Any ideas.

like image 852
Subhasis Avatar asked Dec 24 '10 14:12

Subhasis


1 Answers

The XmlUpdate task can do it. I am using the nightly build from 11/30/2010.

 <XmlUpdate
      XmlFileName="web.config"
      XPath="/configuration/appSettings/add[@key='setting2']" 
      Delete="true" />

The XmlFile task of the MSBuild Extension Pack can also do it:

 <XmlFile
      TaskAction="RemoveElement"
      File="web.config"
      XPath="/configuration/appSettings/add[@key='setting2']" />
like image 177
Brian Walker Avatar answered Sep 20 '22 05:09

Brian Walker