0

I'm running into trouble with config files in my Build/Release pipelines.

Reading this page: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/transforms-variable-substitution?view=azure-devops&tabs=Classic#xml-transformation shows that you can have

*.<stage>.config (for example, fabrikam.Production.config)

I created a file called Web.UAT.config in my asp.net C# WebApplication. The properties on that file is set to Content, DoNotCopy, which should put it in the output directory on publish. I checked the existing web.config file and it's the same.

enter image description here

I want the release pipeline to perform the config transform on my App Service Job, but the problem is that the Web.UAT.config is never copied when publishing.

On my own computer if I right click on the project and select publish, the Web.UAT.config file is also never shown in the output.

How do I force this file to be packaged up in my deployment package so that I can run the transform for the UAT stage?

The plan is to include one for UAT, and one for PRODUCTION so that each one gets the correct settings when the release is pushed out.

Any help would be appreciated.

Cheers,

Albert
  • 1,062
  • 2
  • 13
  • 20

1 Answers1

0

I have figured out how to force the transforms to be included in the publish.

I found the answer here by using an MSBuild target.

After publishing, the transforms are now included.

The release pipeline now runs the transformation based on Stage name for example Web.UAT.config which matches a stage called UAT in my release pipeline. To get it to run the config transform you just need to tick the XML Transformation checkbox in your release step under App Service Deployment.

Albert
  • 1,062
  • 2
  • 13
  • 20