Passing configuration parameters to shell build script
Hi,
I've created a configuration parameter called app.name with a default value of MyApp in the Build Parameters section.
Then in my Build Step I used %app.name% in the Command Parameters textbox.
My question is, how do I get a reference to that app.name parameter from within my shell build script?
I've been trying also sort of combinations with no success...
EDIT: Using Team City 7 Professional
Thanks
Please sign in to leave a comment.
For that you need to declare it as environment variable

Hi Michael,
Thanks for your reply.
But how would I then reference those env variables in my build script?
Thanks
By this name, but without env. prefix
Thanks.
I've tried testing things out with the following but with no success:
echo %env.build.number%
echo build.number
echo %custom.paramater%
Guess I'm missing something here?
Hello,
I'd suggest 2 things:
- use environment variable name without dots in TC settings: env.MY_APP_NAME = value
- Reference environment variable in Windows shell script as %MY_APP_NAME%
Hope this helps,
KIR
Hi,
Thanks for getting back to me.
I did as you suggested but is still unable to reference my env variables from a shell script.
I use: %build.number% (system parameter) and %APP_NAME% (enviroment parameter).
Is it any different for windows shell scripts vs unix shell scripts? Because I'm trying to get this to work using on a Mac OS X enviroment.
Thanks
Ryno, yes, the syntax for expanding environment variables differs between Windows and Unix. In Unix you should use `$APP_NAME` instead of `%APP_NAME%`.
Hi. I'm trying this under windows and passing a path to a Powershell script (set to run as "source code"). I tried a lot of variations to get the path into the script, but everything I tried gave me a path of "null".
It looks like I should define an environment variable (which I did, called "fileURI"), then access it in the source code script as "%fileURI%" - but that doesn't work (null path):