Hi, I need some help with Octopus parameters. I have a Powershell script that updates a configuration file as part of software deployment. The parameter is for the release number of the software, which contains a full stop i.e. 1.0 and I need to know the script to edit this value, making it 1_0. Please can you help.
I have tried a few different variations and have not been able to get it to work. My script is below. Everything else in the script works OK, I just can’t figure out how to amend the release value (the bit in bold below).
$appDirectory = $OctopusParameters["Octopus.Tentacle.Agent.ApplicationDirectoryPath"]
$version = $OctopusParameters["Octopus.Release.Number"]
$ConfigFile = "$appDirectory\path to .config file"
**$verconvert = $OctopusParameters["Octopus.Release.Number"]) - Replace(".","_")**
$content = [System.IO.File]::ReadAllText($ConfigFile).Replace("Initial Catalog=DBNAME;","Initial Catalog=DSXv" + $verconvert + "_Release;")
[System.IO.File]::WriteAllText($ConfigFile,$content)