Best way to retrieve NuGet package version from alternative step

Hi there,

Is there an easy way to reference the version of a package in the current release from a deployment step for a different package? eg. I have a Website.nupkg that needs to know the version of WebsiteAssets.nupkg when the deployment executes.

Currently I am using an output variable in the first package deployment that stores the value and then I reference the same variable in later stages where required. This approach works however, it is very problematic if someone chooses to skip the steps that store the output variables.

Cheers
Luke

Hi Luke,

Thanks for reaching out. Output variables would be the way to go. When you say you a “storing the value in the first package step” do you mean you are creating your own variable using New-OctopusVariable and then using it from another step? I’m asking because we already have a built-in output variable for that during the deployment:

Given a deployment process like the one on the attached screenshot, you can get the pacakage version using the variables

#For step "Deploy1"
$OctopusParameters['Octopus.Action[Deploy1].Package.NuGetPackageVersion']

#For step "Deploy2"
$OctopusParameters['Octopus.Action[Deploy2].Package.NuGetPackageVersion']

Those variables will work even if someone skips a Nuget Package step.

Hope that helps!
Dalmiro