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:
The deployment tool stores the configuration values for each environment and performs configuration transforms at deployment time.
Visual Studio Team Services allows you to define pipelines or release definitions with configuration management and transformations for each environment.
File transforms and variable substitution are also supported by the separate File Transform task for use in Azure Pipelines.
Configuration substitution is specified in the File Transform and Variable Substitution Options section of the settings for the tasks.
The transformation and substitution options are:
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