我有以下 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
覆盖这个行为吗?