psake 4.2.0 error using command line properties argument

371 views
Skip to first unread message

Mike Duran

unread,
Mar 11, 2013, 5:02:46 PM3/11/13
to psake...@googlegroups.com
What am I doing wrong?  I can't seem to get the -properties argument to work.  I get the error below.


psake 4.2.0

<code>
properties {
$environment = "trunk"
}

task default -depends init


task init{

write-host $environment
}
</code>


PS C:\temp> psake .\testbuild.ps1 default -properties @{"environment"="trunk"}

C:\Chocolatey\lib\psake.4.2.0.1\tools\psake.ps1 : Cannot process argument transformation on parameter 'properties'. Can
not convert the "System.Collections.Hashtable" value of type "System.String" to type "System.Collections.Hashtable".
At line:1 char:89
+ & 'C:\Chocolatey\lib\psake.4.2.0.1\tools\\psake.ps1' .\testbuild.ps1 default -properties <<<<  System.Collections.Has
htable; if ($psake.build_success -eq $false) { exit 1 } else { exit 0 }
    + CategoryInfo          : InvalidData: (:) [psake.ps1], ParameterBindin...mationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,psake.ps1

Valera Kolupaev

unread,
Apr 3, 2014, 11:22:06 AM4/3/14
to psake...@googlegroups.com
Hi Mike, 

I had the same problem, as you.
It seems that the root of the problem, is that psake is installed using chocolatey installs "psake.bat" shell tool. So the parameters are converted to windows shell string first, and then converted back. 

The solution I have found, is to import psake module directly into powershell and use Invoke-Psake, instead of psake.bat.

PS C:\dev\XXX\apiserver\scripts> Import-Module C:\Chocolatey\lib\psake.4.3.1.0\tools\psake
PS C:\dev\XXX\apiserver\scripts> invoke-psake upload_api -properties $prop

Mike Duran

unread,
Apr 10, 2014, 2:55:21 PM4/10/14
to psake...@googlegroups.com
Thanks.  I have stopped using the psake.bat file ...and now just use the invoke-psake like you suggest..
Reply all
Reply to author
Forward
0 new messages