Transform non web.config files

Hi I am attempting to perform some transforms on some config files that are not web.config, these are Umbraco Config files. I have created child configs from the default with the relevant naming convention for each environment. e.g.

settings.config

  • settings.Production.config
  • settings.UAT.config
  • etc…

I have the following configuration in my deploy step:

The two web.config files, one in the root and one in the media folder both transform correctly.

but the FileSystemProviders.config and the security.config files are not transformed.
I do see a message in the log to say they have been transformed but no transformation takes place.

eg. FileSystemProviders.config default file

<?xml version="1.0" encoding="UTF-8"?>
<FileSystemProviders>
  <Provider alias="media" type="Umbraco.Core.IO.PhysicalFileSystem, Umbraco.Core">
    <Parameters>
       <add key="virtualRoot" value="~/media/" />
    </Parameters>
  </Provider>
</FileSystemProviders>

and its transform FileSystemProviders.MMCStaging.config

<?xml version="1.0" encoding="UTF-8"?>
<FileSystemProviders xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <Provider xdt:transform="Remove"/>
  <Provider xdt:transform="Insert" alias="media" type="Umbraco.Storage.S3.BucketFileSystem, Umbraco.Storage.S3">
    <Parameters>
      <!-- S3 Bucket Name -->
      <add key="bucketName" value="{YourUniqueBucketName}" />
      <!-- S3 Bucket Hostname - Used for storage in umbraco's database (Should be blank when using Virtual File Provider) -->
      <add key="bucketHostName" value="" />
      <!-- S3 Object Key Prefix - What should we prefix keys with? -->
      <add key="bucketKeyPrefix" value="media" />
      <!-- AWS Region Endpoint (eu-west-2/us-east-1/us-west-1/ap-southeast-2) Important to get right otherwise all API requests will return a 30x response -->
      <add key="region" value="{Region}" />
    </Parameters>
  </Provider>
</FileSystemProviders>

Log output:
Deploying package ‘C:\Octopus\Files\XXS-LiveTag.nupkg-cdf443ae-1b8d-47ef-9f51-3ef794954d0c’ to machine ‘https://server:10933/
18:27:22Info
Deploying package: C:\Octopus\Files\XXS-LiveTag.nupkg-cdf443ae-1b8d-47ef-9f51-3ef794954d0c
18:28:23Info
Performing variable substitution on ‘C:\Octopus\Applications\XXSPath\Web.MMCStaging.config’
18:28:23Info
Transforming ‘C:\Octopus\Applications\XXSPath\FileSystemProviders.config’ using ‘C:\Octopus\Applications\XXSPath\FileSystemProviders.MMCStaging.config’.
18:28:23Info
Transforming ‘C:\Octopus\Applications\XXSPath\security.config’ using ‘C:\Octopus\Applications\XXSPath\security.MMCStaging.config’.
18:28:23Info
Transforming ‘C:\Octopus\Applications\XXSPath\Web.config’ using ‘C:\Octopus\Applications\XXSPath\Web.MMCStaging.config’.
18:28:23Info
Transforming ‘C:\Octopus\Applications\XXSPath\Web.config’ using ‘C:\Octopus\Applications\XXSPath\media\Web.MMCStaging.config’.
18:28:23Info
Transforming ‘C:\Octopus\Applications\XXSPath\Media\Web.config’ using ‘C:\Octopus\Applications\XXSPath\Media\Web.MMCStaging.config’.
18:28:23Info
No matching appSetting, applicationSetting, nor connectionString names were found in: C:\Octopus\Applications\XXSPath\FileSystemProviders.config
18:28:23Info
No matching appSetting, applicationSetting, nor connectionString names were found in: C:\Octopus\Applications\XXSPath\FileSystemProviders.Dev.config
18:28:23Info
No matching appSetting, applicationSetting, nor connectionString names were found in: C:\Octopus\Applications\XXSPath\FileSystemProviders.ProductionWeb2.config
18:28:23Info
No matching appSetting, applicationSetting, nor connectionString names were found in: C:\Octopus\Applications\XXSPath\FileSystemProviders.Release.config
18:28:23Info
No matching appSetting, applicationSetting, nor connectionString names were found in: C:\Octopus\Applications\XXSPath\FileSystemProviders.Staging.config
18:28:23Info
No matching appSetting, applicationSetting, nor connectionString names were found in: C:\Octopus\Applications\XXSPath\security.config
18:28:23Info
Updating appSettings, applicationSettings, and connectionStrings in: C:\Octopus\Applications\XXSPath\Web.config
18:28:23Info
No matching appSetting, applicationSetting, nor connectionString names were found in: C:\Octopus\Applications\XXSPath\Web.Debug.config

Any ideas why this files are not transforming?

Hi,

Thanks for getting in touch! I appreciate you providing all of this helpful information. I’ve given it a test with this info, and while Octopus is attempting to transform, the XML in the transform file isn’t inserting anything into the config. What seemed to get it working for me was to move the xdt:Transform="Replace" from the Provider attribute to Parameters. The full transform file contents then look like this.

<?xml version="1.0" encoding="UTF-8"?>
<FileSystemProviders xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <Provider alias="media" type="Umbraco.Storage.S3.BucketFileSystem, Umbraco.Storage.S3">
    <Parameters xdt:Transform="Replace">
      <!-- S3 Bucket Name -->
      <add key="bucketName" value="{YourUniqueBucketName}" />
      <!-- S3 Bucket Hostname - Used for storage in umbraco's database (Should be blank when using Virtual File Provider) -->
      <add key="bucketHostName" value="" />
      <!-- S3 Object Key Prefix - What should we prefix keys with? -->
      <add key="bucketKeyPrefix" value="media" />
      <!-- AWS Region Endpoint (eu-west-2/us-east-1/us-west-1/ap-southeast-2) Important to get right otherwise all API requests will return a 30x response -->
      <add key="region" value="{Region}" />
    </Parameters>
  </Provider>
</FileSystemProviders>

You can do quick transform testing using a really helpful tool at AppHarbor. This allows you to input config and transform content to test out what it will transform to.

https://webconfigtransformationtester.apphb.com/

Does this help get the transform working as expected? Let me know how you go and if you have any further questions or concerns going forward. :slight_smile:

Kind regards,

Kenny

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.