Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XmlMassUpdate - How to delete a node

We would like to use msbuild to clear the connectionStrings section from a web.config file.

What is the easiest way to do that?

We have previously used XmlMassUpdate to replace values (see also this question: XmlMassUpdate - Replace Value Node), but have not found a way to remove it entirely.

More details:

We would like to change the section in web.config from

<connectionStrings>
  <add name="connectionString1" connectionString="Data Source=localhost\SQLEXPRESS;Initial Catalog=Db1;Integrated Security=True" />
</connectionStrings>

to

<connectionStrings>
</connectionStrings>
like image 722
Ole Lynge Avatar asked Dec 30 '22 02:12

Ole Lynge


2 Answers

Try this in your substitutions file

<connectionStrings xmu:action="remove" />

This should completeley remove the <connectionStrings> tag.

like image 51
jmaragon Avatar answered Jan 01 '23 15:01

jmaragon


Give this a shot:

<connectionStrings>
  <add xmu:key="name" key="connectionString1" xmu:action="remove" />
</connectionStrings>
like image 21
Tom Lianza Avatar answered Jan 01 '23 16:01

Tom Lianza