Copy Nuget Package to Different Directory

Hi Team,

I am new to Octopus Deploy tool.

Currently we are using Octopus Deploy 3.x version and I have configured a Deployment Pipeline, which downloads the Nuget Packages from Artifactory Portal and copies it to “E:\Octopus\Applications” location.

Now I would like to know how to copy the downloaded package to a different directory.

I have written a PowerShell script for this purpose but somehow I am not able to retrieve the Package location using the Octopus Variables.
----------------------------------------PowerShell Script -------------------------------
#StepName = Download_DotNet_Package
Write-Host “Output Path:” $OctopusParameters[‘Octopus.Action[Download_DotNet_Package].Output.Package.DirectoryPath’]
Write-Host “Installation Path:” $OctopusParameters[‘Octopus.Action.Output.Package.InstallationDirectoryPath’]

Please let me know if there is any mistake in the script.

Hi Sudhakar,

Thanks for getting in touch! As your current variable, Octopus.Action[Download_DotNet_Package].Output.Package.DirectoryPath doesn’t exist as a built-in system variable, you can instead use Octopus.Tentacle.CurrentDeployment.PackageFilePath. This deployment-level variable holds the directory that your package has been deployed to within the current deployment. Is this what you’re wanting to do? You can see the full list of system variables in our documentation.

Or are you wanting to move the extracted contents of your package after deployment (i.e. the InstallationDirectoryPath variable)? If this is the case, I would recommend using the custom installation directory feature that’s available on package steps. This will allow you to change the directory where Tentacle extracts your package, and it’s an easier way to do this. You can read more about this feature in our documentation.

I hope this helps! Feel free to expand on what you’re wanting to do if it doesn’t, and I’ll be happy to re-think this. :slight_smile:

Best regards,