Does web.release.config have to be in transform format?

Can it be used to just substitute variables, like below, without the transformations <configuration xmlns:xdt="">?

The goal is to have web.config with dev values, web.release.config will contain the variables that will be substituted when deployed.

Hey @resting

Thank you for your question and for getting in touch with Octopus!

The short answer is no; in order to use the .NET Configuration transforms feature, the transform file needs to include the instructions to tell Octopus which transforms are to be executed on the file. As a result, the feature does not include support for Octopus variable replacement.

However, from your description, I’d recommend taking a look at one of these two other features which should satisfy your requirements:

  1. The .NET XML configuration variables feature. With this feature, Octopus will extract your package and parse your *.config files looking for any appSettings, connectionStrings, and applicationSettings elements where the name matches one of your variables.

  2. The Structured configuration variables feature (Note: The feature was called JSON configuration variables until Octopus 2020.4.0). With this feature you can define variables in Octopus for use in your XML files. This is more flexible than the .NET XML configuration variables feature, since it allows you to support any element in your XML files, and supports any file extension (instead of just .config). You would simply specify the xpath to the element you wish to replace as the variable name. Note: In order for the feature to work, you also need to specify the name of the files you wish the feature to process - wildcards are supported. For example:

Both of these features would allow you to avoid having a Web.release.config file at all, since the replacement values would be stored in Octopus as project variables.

I hope that helps!

Best regards