Getting Version Number for Custom Variable

I am currently on Octopus Deploy 2.5.8.447. I would like to create a custom Octopus Variable to swap out in the app.config that pulls what my version template is doing.

#{Octopus.Version.LastMajor}.#{Octopus.Version.LastMinor}.#{Octopus.Version.NextPatch}

Is this possible? It is not being recognized. I have tried using #{Octopus.Release.Number} which is listed but it provides more information than I need. I just need what is above.

Hi,

Thanks for reaching out. I’m afraid those 3 variables you mention are only available within the context of the project configuration, and not during the deployment. What you could do is put a Powershell step at the top of your deployment process that uses some powershell to break down the value of the variable #{Octopus.Release.Number} the way you want it, and then creates an output variable with that value so you can use it un subsequent steps.

This link shows how to create an output variable and how to consume it from other steps: http://octopusdeploy.com/blog/fun-with-output-variables

If you need more help with this, let me know how you’d like the version string to look like and I’ll give you a hand.

Regards,
Dalmiro