parametreleri, ancak bu değerler sadece .ps1
kök kapsam içinde göz ardı edilir -senaryo.Psake özelliklerini sayar ve hem <code>-properties</code> ve <code>-parameters</code> geçen, benim <code>default.ps1</code> dosya birçok farklı şekilde çalıştırmayı denedim 4.5.0</strong><strong>psake kullanma
( bir alt psake ile ) göreli yürütün:
.\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"}
alınan modül ile yürütün:
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"}
yüklü chocolatey paketinin boyunca yürütün:
aracılığıylapsake .\default.ps1 BuildSolution -properties "@{'a'='a';'b'='b';'c'='c';'d'='d'}" -parameters "@{'w'='w';'x'='x';'y'='y';'z'='z'}"
yürütün:
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'}"
Şu anda default.ps1
basitçe sadece tüm bu değerleri ayıklama edilir:
// 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"
}
:
a:
b:
c:
d:
w:
x:
y:
z:
properties
ve/veya parameters
'u geçmek için uygun sözdizimi nedir?
bu hiç yardımcı olmaz mı? https://github.com/psake/psake/tree/master/examples/passingParametersString –
@ almog.ori Aslında, benimki çok somut iken, bu çok teorik bir örnek. –