Structured configuration variables for xml file

Hi Team,

I’ve the folloiwng xml file, want to replace the key values during deployment for each envt based on the varaibles defined in Octopus. Is this format supported? If so, what will be the variable name for the first key?

Thanks,

Endashaw

Hi @endashaw.adane,

Thank you for contacting Octopus Support.

We have excellent documentation on XML configuration variable replacement here.

The variable name for the first key would be:

db.datasource

Hopefully that gives you the information you are looking for. If you have any additional questions, please don’t hesitate to reach out.

Best Regards,
Donny Bell

Hi @donny.bell ,

did like that but nothing replaced. got the following
22:16:55 Verbose | $The file at C:\Octopus\Applications\DEV-4\Vosco.Ums.Web.Setup\04.21.131-nsb-5b676ad\App_Data\database.settings.xml matches a known filename pattern, and will be treated as Xml. The file will be tried as Json first for backwards compatibility.
22:16:55 Verbose | Attempting structured variable replacement on file C:\Octopus\Applications\DEV-4\Vosco.Ums.Web.Setup\04.21.131-nsb-5b676ad\App_Data\database.settings.xml with format Json
22:16:55 Verbose | The file at C:\Octopus\Applications\DEV-4\Vosco.Ums.Web.Setup\04.21.131-nsb-5b676ad\App_Data\database.settings.xml couldn’t be parsed as Json: Unexpected character encountered while parsing value: <. Path ‘’, line 0, position 0.
22:16:55 Verbose | Attempting structured variable replacement on file C:\Octopus\Applications\DEV-4\Vosco.Ums.Web.Setup\04.21.131-nsb-5b676ad\App_Data\database.settings.xml with format Xml
22:16:56 Info | No structures have been found that match variable names, so no structured variable replacements have been applied.
22:16:56 Info | Structured variable replacement succeeded on file C:\Octopus\Applications\DEV-4\Vosco.Ums.Web.Setup\04.21.131-nsb-5b676ad\App_Data\database.settings.xml with format Xml
22:16:56 Verbose | $The file at C:\Octopus\Applications\DEV-4\Vosco.Ums.Web.Setup\04.21.131-nsb-5b676ad\bin\App_Data\database.settings.xml matches a known filename pattern, and will be treated as Xml. The file will be tried as Json first for backwards compatibility.
22:16:56 Verbose | Attempting structured variable replacement on file C:\Octopus\Applications\DEV-4\Vosco.Ums.Web.Setup\04.21.131-nsb-5b676ad\bin\App_Data\database.settings.xml with format Json
22:16:56 Verbose | The file at C:\Octopus\Applications\DEV-4\Vosco.Ums.Web.Setup\04.21.131-nsb-5b676ad\bin\App_Data\database.settings.xml couldn’t be parsed as Json: Unexpected character encountered while parsing value: <. Path ‘’, line 0, position 0.
22:16:56 Verbose | Attempting structured variable replacement on file C:\Octopus\Applications\DEV-4\Vosco.Ums.Web.Setup\04.21.131-nsb-5b676ad\bin\App_Data\database.settings.xml with format Xml
22:16:56 Info | No structures have been found that match variable names, so no structured variable replacements have been applied.
22:16:56 Info | Structured variable replacement succeeded on file C:\Octopus\Applications\DEV-4\Vosco.Ums.Web.Setup\04.21.131-nsb-5b676ad\bin\App_Data\database.settings.xml with format Xml

I tried this /databaseSettings/add[@key=‘db.datasource’]/@value and this is working. I’ve an other question, how do do same in MSI deploy. I’ve a service with msi installer. and I’ve to do same variable substitutions. I’ve two steps here: one to deploy the package. and another to install the msi via community contributed step template. However, there is no option to add structure configuration variable. any idea?

Regards,

Endashaw

Hi @endashaw.adane,

Just jumping in for Donny, great to hear you got it working with that variable!

Unfortunately the MSI install Step Template doesn’t support Structured Variable Replacement, however it looks like by using the Properties field along with scoped variables you could achieve something similar. E.g. Change values depending on the environment deployed to:


Hope that helps but feel free to reach out if that’s not quite what you were after or if you have any questions about it at all!

Best Regards,

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