Octopus Variables removing host and port on staging enviroment

I have added variables for the network host and port and assigned these to my live enviroment.

<network host="#{_host}" port="#{_Port}" />

This means they have been left blank for my staging enviroment and not assigned and this is stopping the forms from running and its being added to the enviroment config-

<network host="" port="" />

Do I need to include a bit of powershell to delete this line for the staging enviroment and then add it back in for the live enviroment? im not really sure about this?

Hi Harriet!

Removing a line from a config is best handled by using a Configuration Transform, which will apply modifications to your files based on different environments in the deployment process.

If you would like to take a look at https://octopus.com/docs/deployment-process/configuration-features/configuration-transforms - you will get a detailed run-down of using this feature and how you can apply it to your own pipeline.

For your specific example: Once Configuration Transforms is enabled and configured in your deployment step, you could use a transform along these lines to remove the line from the Web.config when the project is deployed to Staging:

<network host="#{_host}" port="#{_Port}" />

<network host="#{_host}" port="#{_Port}" xdt:Transform="RemoveAll"/>

I hope this helps with your problem, and if you have any further questions, please don’t hesitate to let us know!

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