运行 Octopus 中的 powershell 脚本 Deploy w ref to exe in package

Running powershell script in Octopus Deploy w ref to exe in package

部署后,我希望在收到触手时执行脚本,引用包中的 exe。

        Write-Host ("Initial path " + (Get-Location).Path)
    Write-Host ("Will run in " + $Octopus.Tentacle.CurrentDeployment.PackageFilePath)
    Set-Location $Octopus.Tentacle.CurrentDeployment.PackageFilePath

    Write-Host ("Running PingConfigurator")

    $CMD = ".\Tdc.PingConfigurator.App.exe"
    $arg1 = "-e AndersPing9"

    & $CMD $arg1

    Write-host("Migration PingConfigurator")

但是,我在 powershell 中遇到异常,说

Substituting variables in: F:\Octopus\Work180201102638-23-33\PostDeploy.ps1 
February 1st 2018 11:26:43Info
Initial path F:\Octopus\Work180201102638-23-33 
February 1st 2018 11:26:43Info
Will run in  
February 1st 2018 11:26:43Error
Set-Location : Cannot process argument because the value of argument "path" is  
February 1st 2018 11:26:43Error
null. Change the value of argument "path" to a non-null value. 
February 1st 2018 11:26:43Error
At F:\Octopus\Work180201102638-23-33\PostDeploy.ps1:3 char:1 
February 1st 2018 11:26:43Error

我们在谈论什么'path'?我能做些什么来补救?

谢谢,安德斯

这是我以前的做法:

[string]$nuGetDeployStepName = "that step there"
[string]$workingDirectory = $OctopusParameters["Octopus.Action[$nuGetDeployStepName].Output.Package.InstallationDirectoryPath"]

此 returns NuGet 文件解压到的文件夹。