System variables

Hey, within a powershell script I’m accessing the variable Octopus.Release.Number through $version = ‘#{Octopus.Release.Number}’

I would however like to access the nuget package version that is being deployed, which I believe is in the variable Octopus.Action.Package.NuGetPackageVersion - How would I access this during a powershell script in the deployment process

Hi Robert,

Thanks for reaching out. Each package step can deploy a different nuget package, and for that reason the variables that hold the package’s info will always be scoped to a specific step.

Depending on the version of Octopus you are using you could use either $OctopusParameters['Octopus.Action[DeployApp 1].Package.PackageVersion'] or $OctopusParameters['Octopus.Action[DeployApp 1].Package.NugetPackageVersion']

If you are not sure which one is available during your deployment, you can enable these debugging variables in your project and then check the verbose output on your raw deployment log to see which variable holds which value.

Hope that helps,