issue with calculated properties and passing properties from commandline #69

viswaug opened this Issue Jul 12, 2013 · 4 comments


None yet

3 participants

viswaug commented Jul 12, 2013

When using the properties block in the build script with default values, i might have something like this

properties {
$x = 1
$y = 2
$z = $x + $y

Where $z is a calculated variable that is derived from $x and $y

But, I could call the build script from the commandline passing in a value of 5 for $x. In this case, the values for the variables end up being

But, the build script would expect $z to be 7 and not 3. Since the value for $z gets evaluated before the value of $x from the commandline gets set for x, we have this issue.

I don't think psake is designed for this, and this will need me to do funny things to get my variables to values i would expect them to be

Ideally, the default values for non-derived values can come from 3 places. They are listed here in order of incerasing priority

  1. the defaults specified in the property block of the build script
  2. machine specific files that contains values for properties that will override the values above
  3. property values specified from the commandline by the user that overrides both of the above

The 3 things above will need to be evaluated before the calculated/derived properties are calculated.

Any thoughts/suggestions/help regarding this?

Thank You,


I've hit this problem myself. Did you find a sensible workaround?

I've had to use taskSetup to populate a global variable that holds the value of my calculated property

properties {
  $project = 'TestProject'
  $changeset = 'SNAPSHOT'

taskSetup { 
    $global:artifact_name = "${project}-${changeset}"

task echo{
viswaug commented Oct 17, 2013

I have actually modified psake a little to handle the cases above. I can send you the modified source if you are interested. It basically uses another function called "DerivedProperties" just like "Properties" to work around the issues


That would be brilliant actually, I'd be very interested in looking at your modifications!

damianh commented Mar 31, 2014

@viswaug Would like to see that also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment