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.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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']" />