我刚刚安装了psake版本4.2.0。
我把它放在default.ps1
properties {
$message = "Task A executed"
}
task default -depends taskA
task taskA {
write-host $taskAmessage
}
如果我运行Invoke-psake taskA
,则任务按预期执行。
当我执行Invoke-psake
没有任何参数时,就像在introduction中一样,我收到以下错误:
Test-Path : Cannot bind argument to parameter 'Path' because it is an empty string.
At D:\animesh\software\utilities\psake-master\psake-master\psake.psm1:291 char:26
+ Assert (test-path <<<< $buildFile -pathType Leaf) ($msgs.error_build_file_not_found -f $buildFile)
+ CategoryInfo : InvalidData: (:) [Test-Path], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.TestPathCommand
在我的powershell配置文件中,每次运行Powershell时我都会导入psake
模块。
import-module "D:\animesh\software\utilities\psake-master\psake-master\psake.psm1"
项目页面中出现了exact issue,但似乎没有解决。我该如何解决这个问题?
答案 0 :(得分:1)
模块代码似乎有问题,您可能需要将psake.psm1的第269行修改为:
[Parameter(Position = 0, Mandatory = 0)][string] $buildFile=$psake.config_default.buildFileName