Using psake 4.5.0 I've tried to run my default.ps1
file many different ways, passing both -properties
and -parameters
, but those values are just ignored in the root-scope of the .ps1
-script.
Execute relative (with psake in a subfolder):
.\psake-4.5.0\psake.ps1 .\default.ps1 BuildSolution -properties @{"a"="a";"b"="b";"c"="c";"d"="d"} -parameters @{"w"="w";"x"="x";"y"="y";"z"="z"}
Execute with imported module:
Import-Module .\psake-4.5.0\psake.psm1
Invoke-Psake .\default.ps1 BuildSolution -properties @{"a"="a";"b"="b";"c"="c";"d"="d"} -parameters @{"w"="w";"x"="x";"y"="y";"z"="z"}
Execute through installed Chocolatey-package:
psake .\default.ps1 BuildSolution -properties "@{'a'='a';'b'='b';'c'='c';'d'='d'}" -parameters "@{'w'='w';'x'='x';'y'='y';'z'='z'}"
Execute through cmd.exe
:
psake-4.5.0\psake.cmd default.ps1 BuildSolution -properties "@{'a'='a';'b'='b';'c'='c';'d'='d'}" -parameters "@{'w'='w';'x'='x';'y'='y';'z'='z'}"
Right now, the default.ps1
is simply just debugging all these values:
// Since "properties" doesn't get populated, I also try "Param"
Param(
$w = $w, // Trying to populate from passed param
$x = $null, // Trying to default to null-value
$y // Trying another syntax, hoping for population
// "$z" left out, hoping for population
)
properties {
$a = $a
$b = $null
$c
}
Write-Host "a: $a"
Write-Host "b: $b"
Write-Host "c: $c"
Write-Host "d: $d"
Write-Host "w: $w"
Write-Host "x: $x"
Write-Host "y: $y"
Write-Host "z: $z"
Task BuildSolution -Depends Clean {
Write-Host "Running BuildSolution"
}
Task Clean {
Write-Host "Running Clean"
}
The output is in all cases:
a:
b:
c:
d:
w:
x:
y:
z:
What is the proper syntax to pass properties
and/or parameters
to psake?