Config transforms with non-conventional files

Because of our load balancer, we have Octopus set up with two environments (Prod Set 1 and Prod Set 2). We only have one web config transform (Web.Production.config). Can we tell Octopus to use a transform file different than the named convention?

Hi Rob,

Unfortunately not via the UI, but there are two ways.

One is to rename Web.Production.config using a PreDeploy.ps1 script which Octopus will call before running the transforms. You can use the $OctopusEnvironmentName variable within PowerShell to rename it to the right extension. Something like this:

$newName = "Web." + $OctopusEnvironmentName + ".config"
Rename-Item .\Web.Production.config $newName

You can also put the transforms in a Web.Release.config which will be run in all environments that you deploy to (but that will include any pre-prod environments too).

Paul

We implemented your suggestion for renaming the files, and it’s working great.

Thanks