Search code examples
octopus-deploy

Accessing freshly deployed package's library


After Deploy Package step I'm trying to launch a .net core app from a PowerShell script:

Start-Process "dotnet" -WindowStyle Hidden -ArgumentList "xxx.dll"

The program was not started and it looks like the reason is a current directory is not what I expected. After reading the docs my assumption was that current directory is set to a folder where a deployed package was unzipped. It doesn't seem to be the case... I logged current directory using (Get-Item -Path ".\").FullName and got C:\Octopus\Work\20180502194906-1089-109 which seems to be a temporary folder.

How could I access a library from a deployed package?


Solution

  • If your script is in the same step, then (Get-Location).Path should be OK

    However if you want to keep in a separate step, then you will need to access through Octopus variables, something like:

    $OctopusParameters['Octopus.Action[YOUR_STEP_NAME].Output.Package.InstallationDirectoryPath']
    

    Or if you installed to a custom directory, then:

    $OctopusParameters['Octopus.Action[YOUR_STEP_NAME].Package.CustomInstallationDirectory']