Skip to content

Configuration transforms

fDeploy Agent supports .NET XML Document Transform (XDT) for transforming configuration files during deployment. This feature allows you to maintain environment-specific configuration changes using the standard Microsoft XDT syntax, even for files that are not web.config.

How it works

During deployment, configuration transforms run after the package is extracted and before variable substitution. This means you can combine XDT transforms with fDeploy variable substitution for maximum flexibility.

The deployment pipeline order is:

  1. Package upload and extraction
  2. Configuration transforms
  3. Variable substitution
  4. Certificate installation
  5. IIS configuration

XDT syntax

Transform files use the Microsoft XML Document Transform namespace. Here is an example of a transform file that removes the debug attribute from the compilation element:

<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
</system.web>
</configuration>

For more information on XDT syntax, refer to the Microsoft documentation on web.config transforms.

Automatic transforms

When the “Automatically run .NET configuration transformation files” checkbox is enabled on an IIS deployment step, fDeploy Agent will scan your deployed package for transform files that follow the standard naming convention and apply them automatically.

Transform files are applied in this order:

  1. *.Release.config
  2. *.<Environment>.config

For example, suppose your package contains:

Web.config
Web.Release.config
Web.Production.config
Web.Test.config

When deploying to an environment named “Production”, fDeploy Agent will:

  1. Apply Web.Release.config to Web.config
  2. Apply Web.Production.config to Web.config

The Web.Test.config file will not be applied since the target environment is “Production”, not “Test”.

Additional transforms

You can define additional transforms in the “Additional transforms” text field. These transforms run regardless of whether the automatic transforms checkbox is enabled. This is useful when your transform files do not follow the standard naming convention.

Additional transforms are defined using the format:

TransformFile => TargetFile

One transform definition per line. fDeploy supports three types of definitions:

Explicit

Transform.config => Target.config

Applies Transform.config to Target.config when both files are in the same directory. fDeploy will search recursively through all directories in your package for matching pairs.

Relative path

Path\Transform.config => Target.config

Applies Transform.config to Target.config when Transform.config is in the directory Path relative to Target.config.

Wildcard

Wildcards can be used to match multiple files. They can be used anywhere in the transform filename (left side), but only at the start of the target filename (right side).

Wildcard on both sides:

*.Transform.config => *.config

Applies foo.Transform.config to foo.config and bar.Transform.config to bar.config.

Wildcard on transform only:

*.Transform.config => Target.config

Applies foo.Transform.config and bar.Transform.config to the same Target.config.

Wildcard on target only:

Transform.config => Path\*.config

Applies Transform.config to foo.config and bar.config when foo.config and bar.config are in the directory Path relative to Transform.config.

Configuring transforms in fDeploy

To enable configuration transforms on a deployment step:

  1. Navigate to your project’s deployment process
  2. Select or create an IIS deployment step
  3. Expand the “Configuration transforms” section
  4. Check “Automatically run .NET configuration transformation files” to enable convention-based transforms
  5. Optionally, define additional transforms in the “Additional transforms” text field

The configuration transforms section is located between the IIS configuration and variable substitution sections in the step editor.