首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >执行不带参数的Invoke-psake时出错

执行不带参数的Invoke-psake时出错
EN

Stack Overflow用户
提问于 2012-12-10 15:27:28
回答 1查看 884关注 0票数 1

我刚刚安装了psake 4.2.0版。

我把这个放到了default.ps1

代码语言:javascript
复制
properties {
    $message = "Task A executed"
}

task default -depends taskA

task taskA {
    write-host $taskAmessage
}

如果我运行Invoke-psake taskA,那么任务就会按预期执行。

当我不带任何参数执行Invoke-psake时,就像在introduction中一样,我得到以下错误:

代码语言:javascript
复制
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模块。

代码语言:javascript
复制
import-module "D:\animesh\software\utilities\psake-master\psake-master\psake.psm1"

在项目页面中提出了此exact issue,但它似乎没有得到解决。我该如何解决这个问题?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-12-10 22:49:35

似乎模块代码有问题,您可能需要将psake.psm1的第269行修改为:

代码语言:javascript
复制
[Parameter(Position = 0, Mandatory = 0)][string] $buildFile=$psake.config_default.buildFileName
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13796658

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档