Three way config transformation

In visual studio you can have this in your project file to allow you to do a web.config transform when building based on the selected configuration. As part of your project you have a Web.config, Web.Base.config, and Web.{Configuration}.config. This way when you build it applies the selected configurations transform on the Web.Base.config and the output of this is written to Web.config.

In Octopus I need the same thing to happen on deployment. The problem is the syntax Octopus uses only appears to allow the transformed config and the output config to be the same file. Here is what i have in the Additional Transforms box.

Web.Release-#{Octopus.Environment.Name}.config => Web.config

What i really need is something like this…

Web.Release-#{Octopus.Environment.Name}.config + Web.Base.confg => Web.config

How can i accomplish this?

Thanks.

Hi Jason,

Thanks for getting in touch! With your configurations, you can achieve this with the method below. Something like the following should work for you here.

Web.Release-#{Octopus.Environment.Name}.config => Web.Base.confg

Web.Base.confg =>Web.config

The following documentation also has a handful of examples which you can reference for modelling your transformations. If the above example does not work, the link below will give you many others you can use for reference. https://octopus.com/docs/deploying-applications/configuration-files/advanced-configuration-transforms-examples

Let me know if that helps, or if you have any further questions. :slight_smile:

Best regards,
Daniel

That would solve my problem i think however Web.Base.config is not a transform itself, it is just a config file. So with that second line you added “Web.Base.config => Web.config” there are not actually any transform files involved. How will Octopus handle that? Will it just overwrite Web.config with the contents of Web.Base.config?

THanks.

Hi Jason,

Thanks for getting back. I apologize, I gave you a bad example here! The correct method is as below:

Web.Release-#{Octopus.Environment.Name}.config => Web.config
Web.Base.confg =>Web.config

The following section of the documentation that I linked previously covers this briefly. Link to the specific section in the documentation.

Let me know if that helps, or if you have any further questions here.

Best regards,
Daniel