I am trying to figure out the best way to gain access within a step to a file held within a nuget package held within Octopus Deploy
I need to run squirrel against a nuget package but trying to figure out a decent way to extract the exe location from a nugget package held with the library packages I have on the OD server.


Thanks for reaching out. The Octopus built-in Nuget package repository is write-only, meaning you wont be able to manually download a package by your own means. You’re gonna have to first download the package to a directory on the server, and then run Squirrel against the local copy of the package.



Whats the best way to copy a package from the library to a folder rather than extracting its contents?

You’d have to deploy the package as part of the release, then it would get extracted on the server. Once it was there you could find it with some powershell.
If you deployed squirrel and the powershell in a different step you could infer the pathname from the release number.

There’s a list here of the variables available to you. http://docs.octopusdeploy.com/display/OD/System+variables

Hope that helps


So no way to say copy this version of the package to a folder - ill need to deploy then repackage it?


Octopus will always deploy the package (download + extract). If you want to just deal with the .nupkg file, you could make a copy of the package that Octopus downloaded and then use squirrel against that one. This wont stop Octopus from extracting its contents to a folder, but you could add a post deploy script to delete what was just extracted.

To resolve all the paths needed for what I mentioned above, you could use some of the variables mentioned on the link Damian sugested:

Octopus.Tentacle.CurrentDeployment.PackageFilePath will hold the path of the .nupkg file that Octopus extracted

Octopus.Action[Deploy Step Name].Package.CustomInstallationDirectory will hold the path where the contents of the NuGet package were extracted

Hope this makes sense to you. Let me know if it doesnt!