我正在使用web.config转换,如下面的帖子所述,以便为不同的环境生成配置.
http://vishaljoshi.blogspot.com/2009/03/web-deployment-webconfig-transformation_23.html
我可以通过匹配键来进行"替换"转换,例如
<add key="Environment" value="Live" xdt:Transform="Replace" xdt:Locator="Match(key)" />
Run Code Online (Sandbox Code Playgroud)
我可以做"插入",例如
<add key="UseLivePaymentService" value="true" xdt:Transform="Insert" />
Run Code Online (Sandbox Code Playgroud)
但我真正觉得有用的是一个ReplaceOrInsert转换,因为我不能总是依赖原始配置文件有/没有某个键.
有没有办法做到这一点?