概要

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. Idea中快捷键与小技巧的总结-->持续更新

    1.Scala类或单例对象中快速声明实例对象: eg. new SparkContext(conf).var 系统会自动提示,可以自动补全,如图: 2.ctrl+i与ctrl+o的区别: ctrl + ...

  2. Leading and Trailing(巧妙利用log解决次方问题)

    Sample Input 5 123456 1 123456 2 2 31 2 32 29 8751919 Sample Output Case 1: 123 456 Case 2: 152 936 ...

  3. Spring Boot 项目实战(六)集成 Apollo

    一.前言 上篇介绍了 Spring Boot 集成 Dubbo,使我们的系统打下了分布式的基础.随着程序功能的日益复杂,程序的配置日益增多:各种功能开关.参数配置.服务器地址等:对程序配置的期望值也越 ...

  4. python 数据结构之二分查找的递归和普通实现

    二分查找就是待查找的列表进行分半搜索 如下所示 二分查找普通实现: def erfen(alist, item): start = 0 end = len(alist) - 1 while start ...

  5. hadoop安装过程中出现的错误

    此次来记录一下我在安装Hadoop安装过程中出现的错误,安装过程参照慕课网林子雨教程进行安装,在尝试过程中出现的错误如下: 1.在安装Ubuntu时,新建虚拟电脑时,并没有在版本的输入框中有Ubunt ...

  6. html 的实践

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. Centos7常用操作

    1.装完系统无法用scrt连接服务器 查看IP命令 ip addr [root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33 ...

  8. Linux基础(一)磁盘分区

    磁盘分区 一.磁盘结构 先来看看老磁盘 1)磁头(head):不解释 2)扇区(sector):磁盘的最小存储单位,大小为512bytes或者4k 3)磁道(trcack):扇区组成的一个圆 4)柱面 ...

  9. cout endl in c++

    #include<iostream> using namespace std; int main() { cout<<endl; endl(cout); getchar(); ...

  10. Book Lending Registration

    <!DOCTYPE HTML> <HTML lang="|en"> <head> <meta charset="UTF-8&qu ...