From the MSDN documentation on the topic:
<configuration xmlns:xdt="..."> <connectionStrings> <add xdt:Transform="Remove" /> </connectionStrings> </configuration>
Transform="Remove" is the magic you are looking for. There is also Transform="RemoveAll" , which you could use in conjunction with specific add- Transform="RemoveAll" .
EDIT
Alternatively, you can also combine the Locator attribute with the above Remove to limit which items you want to remove.
More specifically:
<configuration xmlns:xdt="..."> <connectionStrings> <add xdt:Transform="Remove" xdt:Locator="XPath(configuration/connectionStrings[@name='ConnStr2'])" /> </connectionStrings> </configuration>
Or something like this should work.
M. Babcock Jan 19 '12 at 3:14 2012-01-19 03:14
source share