Is it possible to use Configuration variables and Configuration transforms settings in the same deploy step?

Hi there,

I have a need to make some environment specific changes to an app.config file for a Windows Service.

I would like to be able to add Environment specific config files to the app.config - e.g. MyApp.Production.config and MyApp.Test.config. I’ll be using different settings in each transform file - i.e. removing and inserting sections using the XDT stuff.

However, I would also like to change some application settings in the app config too. Currently I use Octopus’ configuration variables to do this. E.g.

9036ba6e-8304-437b-b5d4-d2c59edb64ec

On the above example I simply have a variable defined in Octopus called “InstanceID” that I give different values scoped to different machines. When those machines are deployed, the configuration is updated to inherit the correct InstanceID value from Octopus.

I would like to use both these features of OD together. Is this possible somehow? It seems as though the configuration variables step is skipped if the configuration transforms step is enabled.

Hi Sean,

Thanks for getting in touch! Sorry I am having a slightly hard time understanding the problem. So please correct me if I am wrong.
You are finding that if you have both Configuration Variables and Configuration Transforms set, you aren’t getting the full expected behavior.
That doesn’t sound right to me either, but it might just be one is jumping ahead of the other.
Could you please provide a screenshot of your package step settings that has both of these features turned on and a full deployment log.

Thanks!
Vanessa

Hi Vanessa,

Apologies, looks like I opened another ticket for no reason – I do understand how the setting works now. (The two tick boxes and the extra text box in the setting for this feature are a bit confusing to newcomers I think).

After getting my transforms working for the website we are deploying in my other ticket, I had another look at this step in the project (which deploys a Windows Service) and just applied what I learnt on the other side, and all is working as I expected now – the variables get transformed, as well as the App.config file for the service based on the environment name that is being deployed.

All 5 environments in Azure are now working as I would expect in this regard!

Thanks
Sean

Double post, but this one adds more detail than my last one, with a screenshot :slight_smile:

I do understand how the setting works now. (The two tick boxes and the extra text box in the setting for this feature are a bit confusing to newcomers I think) - see attached screenshot with highlight - perhaps in a future version the way the 3 x controls I highlighted are presented to the user could be improved?

After getting my transforms working for the website we are deploying in my other ticket, I had another look at this step in the project (which deploys a Windows Service) and just applied what I learnt on the other side, and all is working as I expected now – the variables get transformed, as well as the App.config file for the service based on the environment name that is being deployed.

The attachment also shows the settings I am now using to deploy my windows service and transform both variables and settings based on environment named config files successfully.

Hi Sean,

Thanks for clarifying and providing the solution!

Vanessa