How to print Octopus package name with the extension of a particular step

I am trying to look for a Octopus variable that helps me print Octopus package name with extension referred in a step. Also can the periods be replaced with any other symbols, can you also help me with this.

Currently using the below variable to print something like PackageName_3.42.28072-28, but I am looking for something like

Write-Host "Package Name: #{Octopus.Action[Deploy UI to Staging Folders].Package.NuGetPackageId}_#{Octopus.Action[Deploy UI to Staging Folders].Package.NuGetPackageId}

Any help would be really helpful.

Eshwar Balakrishna

Hi @eshwarbabub!

The closest variable we have to what you are seeking is Octopus.Tentacle.CurrentDeployment.PackageFilePath, which will return the full path and filename of the package being deployed. You may need to split() it to get just the file name, but that is trivial.

A handy list of all of our system variables can be found in our documentation at

I hope this helps!

1 Like

Hi Justin,

Thanks for the response.

Meanwhile, I work on the above steps. Can you also help me if there is a way to download the project package manually with a step and place it in a Folder location using PowerShell?

The easiest way of doing that particular process would be to make use of the “Transfer a Package” step template to transfer the package to the target. You can specify the transfer path to dictate the final destination of the package file, eliminating the need to script it.

Happy Deployments!

Transfer package step worked but has a different name when compared to the library. Something like but the name in the library is . Do we have any other way to retain its name?

Also the variable Octopus.Tentacle.CurrentDeployment.PackageFilePath seems not working!! Tried Write-host “Package File Path: #{Octopus.Tentacle.CurrentDeployment.PackageFilePath}” but it returns nothing.

Hi again @eshwarbabub!

Octopus.Tentacle.CurrentDeployment.PackageFilePath is only scoped in the deploy step - if you would like to use it outside the deploy step, you would want to do something like:

In your deployment step (Deploy to IIS etc.):

  • Add the “Custom Deployment Script” feature (under configure features).
  • In one of the scripts, add:
    Set-OctopusVariable -name "PackageFilename" -value $OctopusParameters["Octopus.Tentacle.CurrentDeployment.PackageFilePath"]

In later steps, such as a “Run a script” step, you should be able to access the variable

As for the “Transfer a Package” step, we corrected a bug in version 3.7.15 that was causing the transferred package to use the “staging” file name (as you’re seeing), rather than the package name. If you update to a later version, you should just see in the destination directory.

I hope this helps!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.