Vaccano
Vaccano

Reputation: 82291

Pass a Team City Parameter to a PowerShell file

I have the following parameter defined in Team City:

Team City Parameter

I want to pass this parameter into a powershell script I have (that will update the xml file with the version number).

Step With Parameter as Argument

But this inserts the actual text %version% into the script (No substitution is made for the actual value of the parameter.)

However, I know my script is working because if I hardcode the values like this then it works:

Step with hard coded parameter

Is there a way to get %version% to convert to the actual value when when used as a PowerShell script argument?

Upvotes: 6

Views: 15468

Answers (2)

Heavoc
Heavoc

Reputation: 17

You need Environment Variables (env.), it's work to me enter image description here

Upvotes: 0

Matt
Matt

Reputation: 3704

If you put the parameter in quotes, "%version%", and change the script execution mode to Execute ps1 script with "-File" argument then this should resolve and inject correctly

e.g.

enter image description here

Hope this helps

Upvotes: 5

Related Questions