Home > other >  complex web.config transform for different stages in DevOps release pipeline
complex web.config transform for different stages in DevOps release pipeline

Time:05-15

I am new to Azure DevOps and setting up Azure DevOps CI-CD pipeline. Our project solution contains multiple projects including older version of .Net web forms, MVC, APIs, .NetCore projects. web.config or appsettings.js for corresponding project is very complex and contains many customs sections which needs to be modified depending on target environment. Usually we build our solution by passing the environment name to transform the configuration file and push it manually to corresponding environment.

As part of CI-CD we need to automate entire CD for all environments. Build pipeline that we created is following similar approach to pass environment name compiling the projects, then store in artifactory location. Now how can CD pipeline generate or transform config files for intended environment for each stage? Note: After CI process, only transformed web.config is available in articatory location.

CodePudding user response:

CodePudding user response:

Developers effort for this would be adding transform in web.release.config rather than hard coding values. https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/transforms-variable-substitution?view=azure-devops&tabs=Classic

From CI/CD, it should be replacing values dynamically in the Release pipeline based on Token Prefix and Suffix. One such tasks https://marketplace.visualstudio.com/items?itemName=qetza.replacetokens

To preview config transforms in Visual Studio, Utilize https://marketplace.visualstudio.com/items?itemName=GolanAvraham.ConfigurationTransform

  • Related