Psake を使用して単純な PS スクリプトを作成していますが、別の ps1 ファイルをインクルードしようとすると問題が発生します。
PS C:\CI> Include .\EnvSettings.ps1
私はこの例外があります
Exception calling "Peek" with "0" argument(s): "Stack empty."
At C:\Users\Julien\Documents\WindowsPowerShell\Modules\psake\psake.psm1:227 char:2
+ $psake.context.Peek().includes.Enqueue(($pa));
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : InvalidOperationException
何が起こっているのかを確認するために、psake.psm1 の 227 行目を調べました。
# .ExternalHelp psake.psm1-help.xml
function Include {
[CmdletBinding()]
param(
[Parameter(Position=0,Mandatory=1)][string]$fileNamePathToInclude
)
Assert (test-path $fileNamePathToInclude -pathType Leaf) ($msgs.error_invalid_include_path -f $fileNamePathToInclude)
$psake.context.Peek().includes.Enqueue((Resolve-Path $fileNamePathToInclude));
}
コードは Assert 行を正常に渡します。
この問題は Resolve-Path $fileNamePathToInclude から発生し、何も返されません... コマンド ラインから試してみると、正常に動作します。
以前にこの問題を経験した人はいますか?