Cannot get substitute variables in files to work

I have posted this to stackoverflow but the answer was not able to solve my problem

I am using Octopus Deploy 3.3.1 for my deployment.

Within my project I have defined a variable called data.folder

I am trying to use this variable to set the value in a transformation file that was deployed using a package

I have the following Z_Project.config file

<?xml version="1.0"?> /Data

and the following file

<?xml version="1.0"?>

<sc.variable name=“dataFolder” xdt:Transform=“Replace” xdt:Location=“Match(name)” set:value="#{data.folder}" />

Both of these files are located in folder App_Config\Include

As you can see I have set the variable in the transformation file to include the variable “{data.folder}”

Within Octopus, I have created a package deployment step, and have set the following features:

Custom installation directory
Configuration Variables
Configuration transforms
Substitute variables in files

Within the Substitute variables in files I have included the target files


I believe that I have followed correctly, however when the deployment runs. the variable in the file is not being set. and then when Z_Project.config is being transformed it end up with the variable name instead of the value.


Thanks for reaching out.

Could you please follow the below steps to provide a verbose deployment log? It’ll help knowing what happened during your deployment.

1) Add these 2 variables to your project

2) Create a new release (so the new variables take effect) and deploy it. If possible skip as many steps as you can and only leave step we are troubleshooting in order to avoid the noise in the log.

3) Send us the raw log of that deployment


Hi Log file attached

The transformation should take place in step “Deploy Site”

ServerTasks-505.log.txt (1 MB)

Hi Darren,

I’m wondering if this isn’t working because the target you included ( App_Config\Include\Z_Project.#{Octopus.Environment.Id}.config ) has #{Octopus.Environment.Id} instead of #{Octopus.Environment.Name}

The below fragment of your log shows the value during the deployment of each of those variables

09:58:58   Verbose  |       [Octopus.Environment.Id] = 'Environments-1'
09:58:58   Verbose  |       [Octopus.Environment.Name] = 'CI'


Thanks. I will try this out.

But I thought the name was CI as can be seen from the attached screen shot

Hi Malmiro

I made the change you suggested and now everything is working. (Until I add more steps in )

I was creating a library step and have updated the Substitute variables in files to be App_Config\Include\Z_#{Octopus.Project.Name}.#{Octopus.Environment.Name}.config so that it is now fully reusable for me

Thanks for you help