web.config file transform from command line

前端 未结 4 1678
暖寄归人
暖寄归人 2020-12-08 02:27

I have two build environments to target; Release and Staging. The Web.config looks like this:

     
    

        
4条回答
  •  情歌与酒
    2020-12-08 03:29

    If you add the following xml to the bottom of the .csproj file for your web application, you'll ensure that the config transformation occurs before every build:

    
    
        
    
    

    Edit: In response to your comment, you should be able to use Web.config as the source parameter in the TransformXml task (see step #2). If you only want to perform the config transform in the build script, follow these instructions:

    1) Import WebApplication.targets in your build script like so:

    
    

    2) Execute the TransformXml build task in your build script target:

    
        
        ...other build tasks...
    
    

提交回复
热议问题