Transforms and Variables

I am deploying a nuget package and IIS site. I have configured a transform like => web.config and this works. Within the transform i have referenced the environment name variable as #{Octopus.Environment.Name} but this does not return the environment name, it just adds this to the config files.
Am i specifying the correct variable?
I cant see any errors and everything deploys ok, it just doesn’t get the variable.


Hi Shane,

Thanks for getting in touch! I may need to get some further details about how you have configured your project here but the solution may be fairly straight forward.

The feature responsible for config transformation does not evaluate any variables inside your config files. To do this, you will need to use one of the following features. XML Configuration Variables or Substitute Variables in Files.

The XML configuration variables feature will check for any appSettings , connectionStrings , and applicationSettings elements where the name matches one of your variables and substitute it.

Whereas the substitute variables in files feature will check the entire file for any variables with the #{} syntax and evaluate them.

So if you are calling the #{Octopus.Environment.Name} variable outside of the appsettings, connectionStrings, or applicationSettings, then you will need to use the substitute variables in files feature, which can work alongside the other features.

Does that help?

Let me know if you have any questions here, or are running into any issues with this.

Best regards,

Hi Daniel

Thanks for the response. I had already tried the substitute variables in files feature but it didn’t work, I had another look after you mentioned it and realised I hadn’t specified the files to transform,
so my mistake.

Thanks for the pointer, it’s now working.

Shane Walford

Systems Engineer

Hi Shane,

Thanks for the update! I’m glad to hear that you found the issue and have this working now. :slight_smile:

Please don’t hesitate to get in touch at any time.

Best regards,

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