2
votes

What is the syntax to perform type casting for variables in Azure DevOps?

This article - https://docs.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=vsts - suggests there's a "Version" type and mentions a function which would interpret it as a string would resolve it in major.minor.build format but how do you infer a variable as a "Version" type in the first place? And how do you pull out the individual aspects (i.e. major, minor, build, etc.) from it?

1

1 Answers

1
votes

If you look at the types definition, you can see that the type can be guessed by the notation. For instance, if it's wrapped in '', it is a string. Or, if it starts

with a number and contain two or three period (.) characters

it is of type Version.

Regarding the typecasting, it says that Version.TryParse is used. So, if you read this variable in e.g. PowerShell and try to case to Version type, I would expect it to work.