VSTS Release - Define custom variable in web.config and set at release time

RuSs picture RuSs · Feb 25, 2016 · Viewed 8.1k times · Source

I am trying to replace an appSetting at release time using VSTS Release. All post on the web refer to the old release management tool or refer to the new one but mention the replace tokens task. This task does not exist so I presume it is built in. I have set up my web.config (MyVar) and set up my environment variables but nothing gets replaced.

enter image description here

And here is my release: enter image description here

I apologise if I am being stupid but I just can't work this out, mostly due to out of date documentation.

Update 2: Ok so after some help from a couple of people I am now on the right track with this. I have added the Colin's ALM tokenisation task: https://marketplace.visualstudio.com/items?itemName=colinsalmcorner.colinsalmcorner-buildtasks

However, it doesn't work.

Here are a couple of screen shots: enter image description here Note that in the screen shot, I know it is disabled. This is just until I can get it fixed.

In the following screen shot, I see the only a few locations to choose where the tokenisation occurs. Does this look correct or should I be able to see the Web.Config in which I want the tokens to be replaced?

enter image description here

As I said, the tokenisation didnt work.

I tried a couple of changes to try to get it to work.

Change 1: Point to a zip file in above acreen shot. My release worked but it had not deployed any of my web site files to the Azure server. NONE, at all.

Change 2: Point to another file CustomerPortal.SetParams.xml

(Note: at this point I was just trying random file to try and get anything to work) My release worked but nothing happened with regard to tokenisation.

Here is part of my log: enter image description here

As you can see, all my files from my website are not there even though the release was successful: enter image description here

enter image description here

Any help would be appreciate.

Answer

Daniel Mann picture Daniel Mann · Feb 26, 2016

There is no built-in token replacement in the VSTS Release Management. Injecting values into a web.config is a deployment task, and VSTS Release Management is deployment tool agnostic.

If you need to inject values into configuration files (or otherwise alter them) at the time of deployment, that's something you can build into your deployment scripts.