最佳答案
我正在使用下面文章中描述的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)" />
我可以做“插入”。
<add key="UseLivePaymentService" value="true" xdt:Transform="Insert" />
但是我的确发现有用的是ReplaceOrInsert转换,因为我不能总是依赖于具有/不具有某个键的原始配置文件。
有没有办法做到这一点?