XML Configuration Outside of AppSettings and ConnectionStrings

I have a Windows service that has a section in its App.config file that needs modifying per deploy. I have an appSettings node, but the value I want to affect (baseAddress) looks like this:

(many keys)

<system.ServiceModel>








</system.ServiceModel>

Is there a direct way to change this using my project’s Variable page in OctopusDeploy, or am I stuck calling XML transforms from PowerShell? Or does someone have another approach?

Many thanks,

-Seth

Hi Seth,

Currently this needs to be done using PowerShell, though I do have an item in Trello to automatically replace WCF config entries as a convention.

Your PowerShell script can make use of Varaibles defined in Octopus however, so you can use Variables to parametrize the replacement script.

Alternatively you could use a YourApp..config file to perform an XML config transform using Octopus:

https://octopus.atlassian.net/wiki/display/help/XML+Configuration+Files

Hope that helps

Paul

Hi Seth,
I’m using the attached powershell script and calling it as a step in my release with

& $SiteRootPath_deploy\ReplaceOctopusConfigVars.ps1 config | Write-Host
where SiteRootPath is an octopus variable set to the install folder of my site.

It started off with just one variable in one file and has grown - in hindsight I should have just iterated through the octopus variables array…
Might be useful to you?
Cheers,
Adrian

ReplaceOctopusConfigVars.ps1 (5 KB)