Is there a way to remove substitution syntax variables while deploying to a specific environment?


We are using the ‘Substitute variables in files’ feature while deploying an application, we use a Octopus.web.config which has all the variables in it. While deploying web.config is deleted and Octopus config file is renamed as web.config. Problem is some settings/variables only exist in test environment, they dont exist in UAT/PROD environment. Is there a way to get rid of the particular setting when deploying it to a certain environment?


Hi Ram,

Thanks for getting in touch. A typical approach to this is to use Config Transforms. What I would do is:

  1. Enable the Configuration Transforms feature in your Project Step
  2. Add the appropriate configuration transform files to your source code, one for each environment where you want to delete the settings.
  3. Create a new Release with this new version including the config transforms and deploy it.

For more information on the config file transform syntax:

You will specifically need the xdt:Transform="Remove" feature.

Hope that helps!