Satyajit
Satyajit

Reputation: 71

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

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.

Upvotes: 5

Views: 10784

Answers (3)

E. Staal
E. Staal

Reputation: 557

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/

Upvotes: 2

BenV
BenV

Reputation: 12452

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.

Upvotes: 5

starian chen-MSFT
starian chen-MSFT

Reputation: 33728

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.

Upvotes: 4

Related Questions