How to deploy transformations (using Visual Studio) for the Integration app service web.config

  • Updated
Description

First for general info about transform files in DxP and how they work differently depending on where you deploy from please see the following. 

Environment considerations for CMS11 DxP Deployments

Pertinent info:


Adding transform files

Add a file called web.{EnvironmentName}.config (see Identifying the environment for naming conventions) at the same level/folder as the web.config file you want to transform. If you have web.config files at multiple levels/folders that needs transformation, add a transform file next to each one.

The {EnvironmentName}-part should correspond to the value of the application setting with the same name of the target environment for the deployment. For example, to apply a transformation file to web.config when deploying to the Preproduction environment, you add a file called web.preproduction.config that contains the transformation you need.

If you need to do configuration transformations in multiple environments (such as for both Preproduction and Production), then use multiple transformation files, which are applied either from the code package or one after the other as the deployment moves towards the production environment.

Note

The transform files always transform web.config file in the same way but there is still a difference in behavior depending on if deployment is done between environments, or if deploying using a code package. When deploying between environments, the transformation will be applied to the web.config from the source environment. When deploying from a code package, the transformation will be applied to the web.config in the code package.

To make configuration transforms work from Visual Studio you need to make sure you add the transformation files as content files so they are deployed together with the rest of the site.


With the above considerations understood, here are the steps to add transformations to the Integration web.config using Visual Studio. 

Steps
  1. In VS click the configuration dropdown and choose configuration manager
    Configuration_Manager.png
  2. Add a new "Integration" configuration if it does not already exist.
  3. Change the configuration dropdown to Integration.
  4.  In Solution Explorer right click on the web.config and click Add Config Transform.
    config_transform.png
  5. Name it "web.Integration.config" and add the desired transform configurations.
  6. Right click on web.Integration.config and make sure Build Action is set to Content.

    .build_action_content.png
  7. Edit the publish settings and set the Configuration to Integration.
    deploy_setting_configuration.png
  8. Deploy.

Note

When you create a transformation file for Integration you will not see the web.integration.config file in the Integration app service (unless you have modified the .csproj file to make this happen). Instead the transformations in web.integration.config will be applied directly to the web.config being deployed to Integration so there is no need to deploy an additional file. This differs from Preproduction and Production where those transform config files would be deployed to the app service and you do not see the original web.config modified (if you download the PREP or PROD web.config via Kudu it stays the same as the INTE web.config). 

.