我要如何改变web.config中使用转型语法设置? [英] How do I change an web.config setting using transformation syntax?

查看:152
本文介绍了我要如何改变web.config中使用转型语法设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有存储在,我想时,该网站发布改变我的web.config文件中的值。我想把它从测试到LIVE改变。

I have a value stored in my web.config file that I would like to change when the site is published. I want to change it from TEST to LIVE.

<appSettings>
    <add key="RequestMode" value="TEST" />
    // other keys here
</appSettings>

这可能使用的web.config转型语法?如果是这样,怎么样?

Is this possible using web.config transformation syntax? If so, how?

感谢。

推荐答案

是的,这是可能的转型语法。这种变换应该做的伎俩:

Yes this is possible with transformation syntax. This transformation should do the trick:

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <appSettings>
    <add key="RequestMode" value="LIVE" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
  </appSettings>
</configuration>

这篇关于我要如何改变web.config中使用转型语法设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆