Reputation: 181
What is the syntax to perform type casting for variables in Azure DevOps?
This article - https://learn.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?
Upvotes: 2
Views: 1482
Reputation: 32240
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.
Upvotes: 1