1

我有一个非常简单的脚本,它在遵循psake约定(和示例)的任务构建部分中使用 Copy-Item 。现在,这就是它试图简化脚本以调试此问题所做的一切。

错误:

2011 年 7 月 18 日下午 5:40:57:发生错误:

Exec:执行命令时出错:Copy-Item "$src_dir..\somefolder*.dll" $bin_dir

我试过通过 Write-Host 输出文件路径,它们看起来很好。

我需要一些帮助,请调试这个,让脚本代码(Copy-Item)独立工作以psake不是目标。

剧本:

Properties {
    $src_dir = Split-Path $psake.build_script_file
    $bin_dir= "$build_dir\..\Binaries\"
}

include .\psake_ext.ps1

Task Build -Depends Clean, Init {
    Write-Host "about to error here:"

    Exec { Copy-Item "$src_dir\..\somefolder\*.dll" $bin_dir }

    Write-Host "do NOT get this far"
    #more similar Exec copy commands, that don't execute
}

Task Clean {    

}

另请注意:

该脚本正在运行,并且只是在最近的过去间歇性地失败,但现在似乎更加一致地失败。

通过以下方式执行:

.\psake.ps1 "failing-copy-script.ps1" Build
4

1 回答 1

1

所以这个问题有一个答案,总结了问题和其他信息的评论:

如果您遇到此问题要采取的诊断步骤:

  1. “你试过把它关掉再打开吗?” - 关闭任何可能与脚本有关的东西,包括你的 IDE,甚至重新启动你的机器。
  2. 尝试像lockhunter这样的工具
  3. 如果不需要,请避免使用 'Exec { bla }' 命令。
  4. 使用Process Explorer搜索挂钩
于 2012-01-06T03:34:19.567 回答