码迷,mamicode.com
首页 > Web开发 > 详细

TFS online build change web.config

时间:2017-04-04 00:59:12      阅读:153      评论:0      收藏:0      [点我收藏+]

标签:generate   path   uil   .json   online   epo   内置变量   pos   releases   

概要

TFS online 自动编译时如何修改web.config

ref:https://dustinoprea.com/2016/05/06/using-tokenization-token-replacement-for-buildsreleases-in-tfs-2015/

步骤

安装Release Management Utility tasks

https://marketplace.visualstudio.com/items?itemName=ms-devlabs.utilitytasks

 

将 Tokenizer 添加进BuildStep

http://blogs.blackmarble.co.uk/blogs/rfennell/post/2016/03/01/A-vNext-build-task-and-PowerShell-script-to-generate-release-notes-as-part-of-TFS-vNext-build

编写webConfigReplace.json,并提交到tfs

{
  "default": {
    "CustomVariables": {
    "Variable1": "value1",
    "Variable2": "value2"
  },
    "ConfigChanges": [
        {
          "KeyName": "/configuration/metaModel",
          "Attribute":"configSource",
          "Value":"Config\\MetaModel.config"
        },
        {
          "KeyName": "/configuration/connectionStrings",
          "Attribute": "configSource",
          "Value": "Config\\ConnectionStrings.config"
        }
      ,
      {
        "KeyName": "/configuration/runtime/assemblyBinding/probing",
        "Attribute": "privatePath",
        "Value": "bin;binMP;binQF"
      }
      ,
        {
          "KeyName": "/configuration/system.web/compilation",
          "Attribute":"debug",
          "Value":"false"
        }
    ]
 }
}

  

注意:此处default为Environment name,若未配置Environment name,则指定default即可

配置Configuration Json filename: $(Build.Repository.LocalPath)/src/XXX/webConfigReplace.json

注意,此处必须使用$(Build.Repository.LocalPath)变量获取文件根路径。

 

另外,若要使用_XXX_格式替换web.config 中的标记为变量,变量不支持系统内部变量,若要使用系统内置变量,如$(Build.SourceVersion)

可以新建一个用户变量,然后设置其值为$(Build.SourceVersion)

TFS online build change web.config

标签:generate   path   uil   .json   online   epo   内置变量   pos   releases   

原文地址:http://www.cnblogs.com/jianyi0115/p/6663452.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!