leo
leo

Reputation: 455

Azure DevOps XmlTransformation not working properly

I created a release pipeline it is working very well but the XML transformation part is not working as I wanted.

I gave a name for my stage as "Development" and I have "Web.Development.config" file as I showed below, I checked the "XML transformation option" but not is changed. When I add "Web.Release.config" it works but I want to use "Web.Development.config" for the Development environment, I want to use "Web.Production.config" for the Production environment.

When I removed the "Web.Release.config" nothing happens.

When I added the "Web.Release.config" nothing happens. It is skipping or not using "Web.Development.config".

What am I missing? What is the wrong part?

Web config files

Release Pipeline Definition Preview

Release Stage Preview

Upvotes: 3

Views: 1015

Answers (2)

leo
leo

Reputation: 455

After trying a lot of things, finally, I found a solution to my problem. These are the steps:

  1. Go to your build definition, choose "Build Solution" task and add "/p:autoparameterizationwebconfigconnectionstrings=false" as an argument. If you don't do that, the xml transformation process will skip replacing "connectionString" attribute.

enter image description here

  1. Make your all config files as content and mark them as copy always. After your edit, they should be like below in your project file. You should remove Web.config tag.

enter image description here

  1. Go to your release definition and check the XML transformation option.

  2. Make sure that you gave the same name to your stage with your *..config file. You can check this link for more details: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/transforms-variable-substitution?view=azure-devops

Upvotes: 2

Wouter de Kort
Wouter de Kort

Reputation: 39898

By default Azure DevOps uses your web.config and web.release.config and then applies an environment specific config. There is no way to exclude web.release.config from your transformations except from renaming/deleting the file.

See the docs on XML Transformation for all the details.

Upvotes: 0

Related Questions