Custom web.config transformation by excluding

I have a step called “DEPLOY A PACKAGE”, also in my package it has following files web.config,, web.staging.config,,, and

We used octopus to deploy on-premises changes only, so I want to transform web.#{Environment}.config to web.config. But it should exclude{Environment}.config from transformation. How to do it. Is it possible to achieve through .NET Configuration Transforms section.

Hi @rajasingh012,

Thanks for getting in touch!

I expect you should be able to do this by disabling the automatic transform tickbox within the step, as this uses a wildcard that will detect all of the config files and instead use the Additional Transforms box to set an explicit transform pattern. Something like web.#{Octopus.Environment.Name}.config => web.config should work.



Still I have same issue

Is it possible to print the variable #{Octopus.Environment.Name} in the step

Can I confirm that you unticked the “Run default XML transforms” box and created a new release within your project to apply the changes?

You can print the environment variable by invoking it in a standard script step.

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