We are using the new custom powershell feature and have noticed an issue with it. We currently use this feature to run a command line application we have installed on our servers. The path to this application is stored in a library variable. If I specify the following it will generate an error:
Code:
write-host "Run Custom App"
write-host $OctopusParameters[‘ApplicationPath’]
$OctopusParameters[‘ApplicationPath’] /en /f:.\Web.config /s:connectionStrings /force
Error:
You must provide a value expression on the right-hand side of the ‘/’ operator.
At \CustomScriptConvention.PostDeploy.ps1:4 char:63
- $OctopusParameters[‘ApplicationPath’] / <<<< en /f:.\Web.config /s:connectionStrings /force
- CategoryInfo : ParserError: (
[], ParentContainsErrorRecordException
- FullyQualifiedErrorId : ExpectedValueExpression
Fatal 10:27:44
PowerShell script returned a non-zero exit code: 1
- CategoryInfo : ParserError: (
However if we hard code the path then everything works fine. It looks as though the parser you are using is not interpreting the octopus variable correctly when evaluating the power-shell statement.