次のpsakeスクリプトがあります
properties {
$ApplicationName = "test"
$ApplicationPath = "c:\this\is\$ApplicationName"
}
Task test {
"ApplicationName = $ApplicationName"
"ApplicationPath = $ApplicationPath"
}
アプリケーション パス全体を入力するのを避けるために、ApplicationName のみをスクリプトに渡したいと思います。しかし、-parameters
フラグを使用すると、プロパティに変更が適用されません
Invoke-psake .\script.ps1 -parameters @{ApplicationName = "another_test"} test
ApplicationName = test
ApplicationPath = c:\this\is\test
プロパティ ブロックの前にパラメーターを評価する必要があるため、これは正しくないように思えます。-properties
フラグを使用すると、アプリケーション名は変更されますが、パスは変更されません
Invoke-psake .\script.ps1 -properties @{ApplicationName = "another_test"} test
ApplicationName = another_test
ApplicationPath = c:\this\is\test
したがって、プロパティは既に初期化されていますが、-parameters
この動作をオーバーライドするべきではありませんか?