Reputation: 16309
We have a website created in VS 2012. We've right-clicked our web.config file and selected 'Add Config Transform' and created Release and Debug versions of web.config
.
In them we've added some new entries to the <appSettings>
section in both our Debug and Release versions of web.config
:
<appSettings>
<add key="username" value="user" xdt:Transform="Insert" xdt:Locator="Match(key)"/>
<add key="password" value="pwd" xdt:Transform="Insert" xdt:Locator="Match(key)"/>
<add key="GET" value="https://somewhere.com/url1" xdt:Transform="Insert" xdt:Locator="Match(key)"/>
<add key="POST" value="https://somewhere.com/url2" xdt:Transform="Insert" xdt:Locator="Match(key)"/>
</appSettings>
We have experimented with the various transform types, including 'Insert' and 'SetAttribute'. None so far have produced the desired result of adding those new appSettings entries to web.config after a build.
Do we need to put placeholder entries for them in web.config
, or is there another step(s) to this we're missing?
[Edit] the appSettings above are contained in the <configuration>
element in the Debug and Release versions of web.config
.
Upvotes: 0
Views: 538
Reputation: 1171
My guess is that the Insert and the Locator don't work together. If you are doing an Insert, you aren't trying to match it on anything. If you are trying to do a replace, or set some attributes, you would need to do a Locator match. If you are doing an insert, you don't need to look for something (using Locator) as it is net-new.
In a nutshell, if this is a new entry, leave Insert, drop Locate.
Make sense?
Upvotes: 1