.NET XML configuration variables feature - config

Hi,

.NET XML configuration variables feature

Is it possible to point to a customize config file , such as local.cofig ? and also to point to specific config files ?

Thanks

Hi @eldadcohenil and thank you for reaching out.

You can definitely target several files and you can do it in a couple of different ways.

We have a great guide available here that will likely provide you with the information you need. You should also read this section further up on the same page which should provide more context.

Let me know how you get on.

Regards,

Dane

1 Like

Thanks so much on your quick response.
From the article I do not understand where I se my local.config as the only file to be target ?

Thanks

Hi @eldadcohenil,

Firstly, you would need to make sure that “.Net Configuration Transforms” are enabled. This is done in the Step Process page, through “Configure Features”

The recommended way to target that specific file, would be to make sure “Run default XML transforms” is selected.

Octopus can run configuration transformation files. By default Octopus looks for *.Release.config and *.<EnvironmentName>.config.

To have a little more control, you could un-select “Run default XML transforms” and then in the Additional Transforms, you would be able enter in the following transform values.

custom.file.config => local.config

Example:
image

I hope that makes sense. Let me know if you need more clarification.

Regards,

1 Like

Hi,

Thanks so much on your efforts to help me.
My question is How can I point variable to specific config file.
Each config file has different variables to be modify ?

Thanks

Hi @eldadcohenil,

Thanks for keeping in touch! I’ll jump in for Dane for the time being as he’s currently offline as part of our EU-based team. :slight_smile:

If I understand your scenario correctly, what I think you might be wanting to use is our structured configuration variables feature. This allows you to specify where to substitute a variable value into in your config file by the project variable’s name (for example, a variable named /app/port in your Octopus project will replace the value in an XML config file under the app → port section of the config). This also allows you to specify individual config files to apply this feature to. A lot more details and examples are outlined in the above linked documentation page for this feature.

Alternatively, you can use the substitute variables in templates feature, where the variables will be matched by defining the Octostache syntax in your .config file (e.g. #{VariableName}).

I hope this helps, and please don’t hesitate to follow up with any additional questions or concerns!

Best regards,

Kenny

2 Likes

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