Перейти к содержимому

Transforming deployed configuration file in Azure web app

While this guide is primarily targeted towards usage with Web apps and ASP. solution deployed on them, still it is possible to use it on on-premise solution with other types on ASP.NET projects, running on Windows.

Reasoning behind this

Why I actually started building all this thing up, ignoring interesting Helix publishing pipeline or dropping idea of storing source and transformation files in my source control?

In Helix publishing pipeline I do not like the fact that I could not use different transformation based on roles, where I am deploying (if it is there - can you point it to me?).

When storing vanilla config in source control - I do not like the fact that I will need to update it when I am updating Sitecore version (hence, merging and solving possible conflicts).

Solution

So, I decided to build this transformation thing anew, almost from scratch. I used the same idea as used in Helix publishing pipeline: store only transformation files under source control, as, in general, they are generic. Also, I agreed on following naming convention:

  • configFileName.config.xdt - transforms config file with name configFileName.config lying at this path for all environments
  • configFileName.config.xdt.roleName - transforms config file with name configFileName.config lying at this path when deploying this particular role

That's is a script, which could be uploaded to web app and executed via . Script wants several parameters:

  • folderWithTransforms - folder, where all transform files are residing
  • webRoot - folder, where webRoot could be found
  • roleName - optional, if there is a specific tranformations for this particular role
  • transformationAssemblyPath - if .Web.XmlTransform.dll is not at the same path as script

Похожие записи