Passing Arguments To My Build Script

11 views
Skip to first unread message

Chris Bilson

unread,
Oct 19, 2009, 11:47:52 AM10/19/09
to psake-users
What's the best way to pass arguments to my build script? I'm sure
this has come up before but am having trouble finding any information
on how to do this.

For example, say I want the pass a version number to my build script,
maybe from a continuous integration server like Team City. The only
way I can see to do it is to use and environment variable. Is that
what others are doing?

I'd like to be able to do something like:

psake .\default.ps1 -Version 1.42 -Configuration Debug -Foo Bar

Shaun Becker

unread,
Oct 19, 2009, 2:42:11 PM10/19/09
to psake...@googlegroups.com
You don't have to use environment variables. You can just use local variables:

$Version='1.42'
$Configuration='Debug'
$Foo='Bar'
psake .\default.ps1

then just reference those variables from within your script as you would any other

Thanks,
Shaun

Eric Hexter

unread,
Oct 19, 2009, 3:24:11 PM10/19/09
to psake...@googlegroups.com
In order to get those values from a CI server you would need to pass them through the powershell.exe ... right?
 
powershell.exe  psake.exe default.ps1
 
How does the parameter from the CI server get into the powershell host initially?
Reply all
Reply to author
Forward
0 new messages