Transform web.config file as per environment while release on VSTS
Asked Answered
F

3

5

Web.config file is transformed locally with different environments like(DEV, QA, Prod). How these environment specific config files will be used while release the application on different environment like(DEV, QA, Prod) on VSTS.

Fatso answered 30/10, 2017 at 11:33 Comment(0)
C
5

Both the Azure and IIS deployment tasks now support file transforms and variable substitution.

The File Transformation will look for and apply a *.<environment>.config transform file where <environment> matches the Azure Pipeline environment for which the task is executing.

Variable Substitution will apply the value of any pipeline variables to the corresponding connectionStrings or appSettings entries where the name matches the variable name.

Calan answered 16/4, 2019 at 20:53 Comment(0)
B
4

There is XDT Transform extension that can apply transform for config file, so the easy way is that you can include/add the related configure files in release artifact, then configure transform per to release environments.

Another way is that you can replace the value in configure file through Replace Tokens or Tokenization task.

On the other hand, if you are deploying the app through Azure App Service Deploy task, there is File Transforms & Variable Substitution Options that can do transform.

Biflagellate answered 31/10, 2017 at 2:58 Comment(1)
The first option here - XDT Transform task in release pipeline - will help if you still want to run your application locally using just the Web.Config. The transforms apply accordingly in the release pipeline for each stage (Dev, Test, Stage, Prod, etc) The second option - Replace Tokens - will work if you don't have to run your app locally using the web.config file because for this approach we need to set up the web.config values in the format like #{ }# and that gets transformed in release pipeline but when running in Visual Studio, it won't work because of the #{}# values in web.configDiaphone
P
2

Yesterday I published a blog on how to do this in VSTS: https://www.4dotnet.nl/kennis/blog-deploying-your-asp-net-web-app-and-database-to-azure-using-vsts

In other scenario's, I've successfully used the XDT Transformation Tool: https://ctt.codeplex.com/

Polson answered 31/10, 2017 at 9:46 Comment(2)
link's dead to the blog postAlliteration
Thanks for the notification, fixedPolson

© 2022 - 2024 — McMap. All rights reserved.