azure-devopsazure-pipelines-release-pipelinexdt-transform

Azure DevOps Release transform/replace tokens


I have 2 config files, ConnectionStrings.config and ConnectionStrings.Release.config. These files are used to store various connection strings we use in our app.

<?xml version="1.0" standalone="yes"?>
<ConnectionStrings xmlns="http://tempuri.org/ConnectionStrings.xsd">
  <Service>
    <Name>MyService</Name>
    <Address>http://localhost/#{ConnectionString}#/MyServiceService.svc</Address>
    <ClassName>MyClass, MyClass</ClassName>
  </Service>
</ConnectionStrings>

When we deploy locally we use the normal ConnectionStrings.config without any replace tokens in the file. The .release.config is the one that has the tokens.

I'm using these 2 market place tasks [Tasks in my release pipeline] 1

From what I understand, the transform task is taking the .release.config file and "renaming it" .config, then the replace tokens task replaces the necessary tokens with variables in my pipeline. Finally I copy these to my target. My source of the copy task is my Git working directory in Azure.

When I check the results, I don't see the ConnectionStrings.config changed at all and its just copied over like if it was a local deploy.

What am I doing wrong?


Solution

  • It seems that you are using this extension: XDT Transform. After installing it in my organization, there are 2 external tasks: XDT tranform task and Replace Tokens task in release pipeline.

    below is my repository structure, the ConnectionStrings.config and ConnectionStrings.Release.config. enter image description hereenter image description here And my release pipeline looks like below. enter image description here I create a pipeline variable ConnectionStrings, and set its value to hello_world, use the PowerShell script gc _215\ConnectionStrings.config to print the replaced result. Creating a new release we can see below log. enter image description here Thus it works as expected.