概要

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)变量获取文件根路径。

另外,

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

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

2)若config节点有namespace,则需要指定

{
"NamespaceUrl": "urn:schemas-microsoft-com:asm.v1",
"NamespacePrefix": "asm",
"KeyName": "/configuration/runtime/asm:assemblyBinding/asm:probing",
"Attribute": "privatePath",
"Value": "bin;binMP;binQF"
}

TFS online build change web.config的更多相关文章

  1. Web.config Transformation Syntax for Web Application Project Deployment

    Web.config Transformation Syntax for Web Application Project Deployment Other Versions   Updated: Ma ...

  2. 【Hello CC.NET】自动化发布时 Web.config 文件维护

    在 <[Hello CC.NET]CC.NET 实现自动化集成> 的 HellowWorld 中经实现: 1.获取源码 2.编译项目 3.集成测试 4.Ftp发布项目 5.创建安装包 6. ...

  3. CC.NET-自动化发布时 Web.config 文件维护

    [Hello CC.NET]自动化发布时 Web.config 文件维护   在 <[Hello CC.NET]CC.NET 实现自动化集成> 的 HellowWorld 中经实现: 1. ...

  4. 10 Things ASP.NET Developers Should Know About Web.config Inheritance and Overrides(转)

    10 Things ASP.NET Developers Should Know About Web.config Inheritance and Overrides Wednesday, Janua ...

  5. asp.net设置默认打开页面,Web.config,defaultDocument

    The web.config file can be used to set a default document, or list of default documents for your web ...

  6. 使用Web.Config Transformation配置灵活的配置文件

    发布Asp.net程序的时候,开发环境和发布环境的Web.Config往往不同,比如connectionstring等.如果常常有发布的需求,就需要常常修改web.config文件,这往往是一件非常麻 ...

  7. 转:Transform Web.Config when Deploying a Web Application Project

    Introduction One of the really cool features that are integrated with Visual Studio 2010 is Web.Conf ...

  8. How to Build Office Developer Tools Projects with TFS Team Build 2012

    Introduction Microsoft Visual Studio 2012 provides a new set of tools for developing apps for Office ...

  9. Autofac的注入和web.config配合

    public static void BuildMvcContainer() { var builder = new ContainerBuilder(); var assemblys = AppDo ...

随机推荐

  1. win10系统桌面快捷键图标异常解决方法

    win10系统桌面快捷键图标异常解决方法 前言: 有一次我的一个图标变成白色,找到:https://jingyan.baidu.com/article/948f5924148e67d80ef5f947 ...

  2. sql union 列的字段不一样的时候

  3. 初心不负 笔记-JS高级程序设计-引用类型篇-Array

    ES3方法集合: 1join()方法,将一个数组里面的所有元素转换成字符串,然后再将他们连接起来返回一个字符串,通过制定的符号,默认值为逗号.不会改变原数组 ,,,,]; a.join(); &quo ...

  4. hadoop离线计算项目上线配置问题记录

    最近上线一个hadoop离线处理项目,因为在低配置(8G,4核)的时候装的CDH,后来集群配置(64G,16核)上来了,但许多参数不会自动修改,需要自己调整,处理过程中遇到的配置问题记录下. 1.hi ...

  5. SpringBoot返回json和xml

    有些情况接口需要返回的是xml数据,在springboot中并不需要每次都转换一下数据格式,只需做一些微调整即可. 新建一个springboot项目,加入依赖jackson-dataformat-xm ...

  6. FasterRCNN代码解读

    之前的文章简要介绍了Faster-RCNN等物体检测的算法,本文将从代码角度详细分析介绍Faster-RCNN的实现.本文使用的代码参考了chenyuntc的实现,代码的位置看这里.需要注意的是,本文 ...

  7. BZOJ.4402.Claris的剑(组合 计数)

    BZOJ 因为是本质不同,所以考虑以最小字典序计数. 假设序列最大值为\(m\),那么序列有这两种情况: \(1\ (1\ 2\ 1\ 2...)\ 2\ (3\ 2\ 3\ 2...)\ 3\ (4 ...

  8. Android中,如何提升Layout的性能?

    Layout 是 Android 应用中直接影响用户体验的关键部分.如果实现的不好,你的 Layout 会导致程序非常占用内存并且 UI 运行缓慢.Android SDK 带有帮助你找到 Layout ...

  9. STM32——C语言知识点:指针、结构体

    /* ============================================================================ Name : Cyuyanfuxi.c ...

  10. 种花 [JZOJ4726] [可撤销贪心]

    Description 经过三十多个小时的长途跋涉,小Z和小D终于到了NOI现场——南山南中学.一进校园,小D就被花所吸引了(不要问我为什么),遍和一旁的种花园丁交(J)流(L)了起来. 他发现花的摆 ...