qetza / vsts-xdttransform-task

Visual Studio Team Services Build and Release extension that applies XDT transforms on XML files.
MIT License
20 stars 9 forks source link

XML Transform not change config #18

Closed YohanesDoank closed 5 years ago

YohanesDoank commented 5 years ago

Hello,

I have 1 file with custom name, AppSettings.DSO.config, this config containing value like below:

<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <appSettings>
    <add xdt:Transform="Replace" xdt:Locator="Match(key)" key="BaseUrl" value="https://github.com"/>
  </appSettings>
</configuration>

and my original AppSettings.config:

<?xml version="1.0" encoding="utf-8" ?>
<appSettings>
  <add key="BaseUrl" value="www.google.com"/>
</appSettings>

and the result value after transform just same like the originial config(nothing change).

log history:

2019-05-15T04:36:50.5030154Z Applying transformations 'E:\Agents\ReleaseAgent01\_work\r3\a\OnlineOrder-Build-Manual-QA-Non-Template\OnlineOrder.API-QA\Config\AppSettings.DSO.config' on 'E:\Agents\ReleaseAgent01\_work\r3\a\OnlineOrder-Build-Manual-QA-Non-Template\OnlineOrder.API-QA\Config\AppSettings.config' to 'E:\Agents\ReleaseAgent01\_work\r3\a\OnlineOrder-Build-Manual-QA-Non-Template\OnlineOrder.API-QA\Config\AppSettings.config'...
2019-05-15T04:36:50.6147773Z ##[section]Finishing: Transform Config File's for DSO

here's the screenshot of my release task using XDT Transform task: image

is there's missing step sir? or any additional setting's maybe?

Speedy7912 commented 5 years ago

you are missing the <configuration> part in your original app.config?

Like so:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
  <add key="BaseUrl" value="www.google.com"/>
</appSettings>
</configuration>

P.S. you can test your transformation on a site like : https://webconfigtransformationtester.apphb.com/

YohanesDoank commented 5 years ago

Oh no..... my bad,

it works now thank you so much 👍 @Speedy7912

qetza commented 5 years ago

Closing the issue as it seems resolved. Thanks @Speedy7912 for the help.