Passing parameters to file ?



how can i pass parameters to file in TeamCity. I can get it to work if i just type in my "code" under Source but i would really like to have the "file" option working to have as i can store it in my version control

Small example:

In teamCity I define a "Environment Variables" and give the properties "hidden" and "password" and of course a "Value" = XYZ

the file "GitFile.ps1" :

$Variable = %env.NAME.SOME%
write-host $Variable

Expected outcome: 

Value of Teamcity Environment parameter XYZ

As i said it works fine in source, but not in "file".




1 comment
Comment actions Permalink


followed this guide:

and Changed the parameter syntax from  %env:NAME.SOME% to $env:NAME_SOME (dot,":" and $)

this worked:

$Variable = $env:NAME_SOME
write-host $Variable


Please sign in to leave a comment.