概要

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. sql 的一些总结

    如果用到“每”  就要用到group  by   例:每个部门有多少人,就要用到分组技术 聚合函数一般作用在多条记录上 having 是分组厚的筛选条件,分组厚的数据组内再筛选,where 则是在分组 ...

  2. NiftyNet开源平台使用

    NiftyNet是一款开源的卷积神经网络平台,专门针对医学图像处理分析,上一篇博客已经详细介绍了这个平台,接下来让我简单介绍一下目前我了解到的使用方法.更详细的使用方法.以及配置过程请查看NiftyN ...

  3. vs2008单元测试

    调试是解决错误的过程,测试是发现软件缺陷的过程.每一个软件在交付使用时前都必须经过测试.软件测试是软件开发的重要组成部分,现在已经发展成专门的技术. 在消除了程序中的语法错误和运行错误后,程序仍然不能 ...

  4. SQL 2016 正式版 安装过程

    1.点击全新安装 2.接着就是下一步,下一步... 3.选择你要安装的功能    [可以利用PolyBase,使用标准TSQL查询hadoop数据,但这里我不需要装] 4.设置排序规则 5.设置登录用 ...

  5. SQL 自定义存储过程报错

    begin catch ), @ErrSeverity int SELECT @ErrMsg = ' SP Error: '+ERROR_MESSAGE(), @ErrSeverity = ERROR ...

  6. XamarinSQLite教程添加测试数据

    XamarinSQLite教程添加测试数据 此时创建的Students表中是没有任何数据,也就是一个空表.为了方便测试App,开发者需要为表添加一些数据.操作步骤如下. (1)右击创建的Student ...

  7. POJ1700----Crossing River

    #include<cstdio> #include<iostream> #include<cstring> #include<algorithm> us ...

  8. Hello 2019 (D~G)

    目录 Codeforces 1097 D.Makoto and a Blackboard(DP 期望) E.Egor and an RPG game(思路 LIS Dilworth定理) F.Alex ...

  9. BZOJ3877 : [Ahoi2014&Jsoi2014]保龄球

    考虑从前往后放所有轮. 如果上一轮是全中: 那么这一轮如果是补中,一定放第一次最小的,这样可以让第一次大的放在其它补中之后. 如果这一轮是失误,那么一定放总分最大的. 如果上一轮是补中: 这一轮一定放 ...

  10. Linux命令行使用

    FHS:标准文件架构规范用好man命令su - name 切换到用户namesu - rootchmod 777 filenamecd -:上一个工作目录cd ~:用户的家目录cd ~nid:q切换到 ...