I have a few connection strings in my web.config that I want to remove using web.config transformation when I deploy my web app. I had found the MSDN page talking about web.config transformation but it only list a "Remove" which removes the first entry or
the "RemoveAll" that deletes them all. Is there a way to only remove specific connection strings?
I had found the MSDN page talking about web.config transformation but it only list a "Remove" which removes the first entry or the "RemoveAll" that deletes them all. Is there a way to only remove specific connection strings?
That artical I talk about is the exact one you pointed me to which, as I said, only tells you how to remove them all or only remove the first entry. I need to be able to specifiy which entries to remove.
If the "remove" is removing the first entry, you must not have specified a locator. You need an "xdt:locator" to tell the transform engine which entry you're talking about. There are several examples in the page quoted above, but under different verbs
(check the Match command).
This locator finds the key specified, then the transform verb says to remove the node.
Member
224 Points
685 Posts
Removing specific connection strings in web.config transformation
May 26, 2013 05:08 PM|Eagle_f90|LINK
I have a few connection strings in my web.config that I want to remove using web.config transformation when I deploy my web app. I had found the MSDN page talking about web.config transformation but it only list a "Remove" which removes the first entry or the "RemoveAll" that deletes them all. Is there a way to only remove specific connection strings?
All-Star
52523 Points
15668 Posts
Re: Removing specific connection strings in web.config transformation
May 26, 2013 08:26 PM|oned_gk|LINK
http://msdn.microsoft.com/en-us/library/dd465326.aspx
Suwandi - Non Graduate Programmer
Member
224 Points
685 Posts
Re: Removing specific connection strings in web.config transformation
May 26, 2013 08:33 PM|Eagle_f90|LINK
As stated in my original post:
That artical I talk about is the exact one you pointed me to which, as I said, only tells you how to remove them all or only remove the first entry. I need to be able to specifiy which entries to remove.
Member
10 Points
1 Post
Re: Removing specific connection strings in web.config transformation
Jun 03, 2013 02:15 PM|bradirby|LINK
If the "remove" is removing the first entry, you must not have specified a locator. You need an "xdt:locator" to tell the transform engine which entry you're talking about. There are several examples in the page quoted above, but under different verbs (check the Match command).
This locator finds the key specified, then the transform verb says to remove the node.
<add key="myKeyToRemove" value="UnimportantValue" xdt:Transform="Remove" xdt:Locator="Match(key)"/>