How do I change an web.config setting using transformation syntax?

后端 未结 4 538
甜味超标
甜味超标 2021-02-05 07:05

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.


           


        
4条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-05 07:23

    This is possible out of the box using Visual Studio 2010. The only caveat is this process is run from within Visual Studio when you use the Publish facilities within it. You won't get the ability to get this transformation from MSBuild (which hampers automated builds).

          
    

    Source: Web.Config Transformations VS 2010

    Also ensure your Web.Config.XXXX tranformation file matches your build definition. For instance, debug and release are supported by default so you would need to have a Web.Config.Release to adjust the Web.Config when publishing in release mode.

提交回复
热议问题