TFS Online Build change web. config

Source: Internet
Author: User
Tags connectionstrings

Profile

How to modify Web. config when TFS online compiles automatically

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

Steps

Install release Management Utility tasks

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

Add Tokenizer into 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

Write the Webconfigreplace.json and submit it to 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 '        }    ]}}

  

Note: The default is environment name here, and if environment name is not configured, specify default to

Configuring the configuration Json FileName: $ (Build.Repository.LocalPath)/src/xxx/webconfigreplace.json

Note that you must use the $ (Build.Repository.LocalPath) variable here to get the file root path.

Also, to replace a tag in Web. config with a variable in the _XXX_ format, the variable does not support system internal variables to use system built-in variables, such as $ (build.sourceversion)

You can create a new user variable and set its value to $ (build.sourceversion)

TFS Online Build change web. config

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.