概要

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. Mysql 查询实现成绩排名

    Mysql 查询实现成绩排名,相同分数名次相同,类似于rank()函数 近日系统要实现总分成绩排名,而且相同分数的学生排名要一样,在网上搜了一圈,没有找到合适的方法,只能靠自己实现了,这里提供两种方法 ...

  2. 动态规划-poj1949

    题目链接:http://poj.org/problem?id=1949 题目描述: 思路:用一个数组dp来存完成第i个任务时所需的最短的时间,dp[i] = max(dp[j]) +time, j是需 ...

  3. TF之AE:AE实现TF自带数据集AE的encoder之后decoder之前的非监督学习分类—Jason niu

    import tensorflow as tf import numpy as np import matplotlib.pyplot as plt #Import MNIST data from t ...

  4. HDU 2196 Computer (树上最长路)【树形DP】

    <题目链接> 题目大意: 输出树上每个点到其它点的最大距离. 解题分析: 下面的做法是将树看成有向图的做法,计算最长路需要考虑几种情况. dp[i][0] : 表示以i为根的子树中的结点与 ...

  5. nginx: [error] open() "/var/run/nginx/nginx.pid" failed (2: No such file or directory)

    在重启nginx服务的时候,出现了这个错误. [root@izuf68g6a94fj32w0afx00z etc]# nginx -c /var/run/nginx/nginx.pid nginx: ...

  6. shiro学习总结(一)----初识shiro

    本系列内容大多总结自官网和张开涛的<跟我学Shiro> 一.shiro简介 1.1.shiro有什么用? shiro是一个功能强大使用简单的java安全框架,主要提供了五大功能: 1.认证 ...

  7. 《重回耶路撒冷——犹太人的三千年》(Return to Jerusalem)读后感

    写在前面 书名:<重回耶路撒冷——犹太人的三千年>(Return to Jerusalem) 作者:张力升 来源:长清图书馆 阅读用时:其实年前拿到书,本来想寒假在家看的,但是在家一点儿都 ...

  8. SQL的多种JOIN

  9. [BZOJ4259]残缺的字符串

    Description: 给定两个带通配符的串,求可能出现几次匹配,以及这些匹配位置 Hint: \(n \le 3*10^5\) Solution: 定义匹配函数 \(P(x)=\sum_{i=x} ...

  10. Jmeter5 实现多机集群压测(局域网组成多机集群)

    想要模拟高并发用户访问的场景,用Jmeter5实现的话,单靠一台PC机,资源是不够的,包括单机的内存.使用端口数量等,所以最好是通过多台PC机组成几个集群来对服务器进行压测. 本文目录: 1.软硬件配 ...