Why doesn’t psake evaluate my property the way I expect?

Question:

I have a simple psake script:

And I am calling it from the command line like this:

& .\psake.ps1 .\deploy.ps1 -properties @{"Config"="Staging"}

I would expect $DeployBaseDir to be equal to SOLUTIONDIR\RMSS.Setup.WiX\bin\Staging

But instead, I get this output:

Can anyone tell me what’s happening, why, and how to get the behavior I expect?

Answer:

From here http://codebetter.com/jameskovacs/2010/04/12/psake-v4-00/

Support for Parameters and Properties

Invoke-psake has two new options, –parameters and –properties. Parameters is a hashtable passed into the current build script. These parameters are processed before any ‘Properties’ functions in your build scripts, which means you can use them from within your Properties.

Parameters are great when you have required information. Properties on the other hand are used to override default values.


So you could either take $Config out of the properties and pass it in as a parameter.
Or take the $DeployBaseDir out of the properties and create it inside the task block

Source:

Why doesn’t psake evaluate my property the way I expect? by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply