Set parameter via service messages

I am trying to set a configuration parameter via service messages in a powershell build step so the following steps can use the updated parameter.

My configuration parameter called %config.AppName% has a default value of 'develop'.

The powershell build step looks like:

$AppName = [regex]::match('', '([^/]*)$').value
write-host "##teamcity[setParameter name='AppName' value='$AppName']"
write-host %config.AppName%

I would expect the last line to print the updated value but instead it is always printing the default value, develop - as also the following build steps use the default value.

Anything I am missing?

1 comment
Comment actions Permalink

The parameter resolution is not available during powershell script execution. TC resolves all parameters it can before starting the build step. In addition, it is not available at all, if you choose to run powershell from file, not from custom script (text area).

If you need to have this value, you need to add another build step.


Please sign in to leave a comment.