I have my applications in Azure DevOps. For each application, I created a build pipeline and then a release pipeline. I have 3 environments: dev
, sit
and uat
.
In the Library, I created the values to replace in the appsettings.json
for each environment. I associated each variable group with each stage.
For example, in the Library I added a key like
ConnectionStrings.MyConnection
to replace the value in the appsettings.json
{
"ConnectionStrings": {
"MyConnection": "",
}
}
When I check the appsettings.json
in the environment, there is no update in the file. The value set in the Library is not replace/add to the configuration file.
This is the configuration of the release pipeline
In DevOps the appsettings.json
isn't changed unless you actually tell one of the tasks to do it. Looking at your tasks, none of them changes the appsettings.json
.
File Transform allows you to change the appsettings.json
. If you place that Task before you extract the files you can first modify the AppSettings in the zip file.
In "Package or Folder" point to the zip file, and don't forget to point to the appsettings.json
file in the "JSON target files".