Azure pipeline YAML: assign variable to another variable

Andrii Dusheba CW 1 Reputation point
2021-07-30T09:51:29.613+00:00

I want to define variable version_ that consists of other my variables, like this:

119386-image.png

but variables major, minor, versionCounter and branchPrefix aren't recognized, and this syntax is just transformed into string

I tried to use $(major) syntax, but it also didn't work.
How can I fix it?

Azure Stack Hub
Azure Stack Hub
An extension of Azure for running apps in an on-premises environment and delivering Azure services in a datacenter.
178 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. KarishmaTiwari-MSFT 18,352 Reputation points Microsoft Employee
    2021-07-31T00:11:47.487+00:00

    The Azure DevOps team and community are active and answering questions on https://developercommunity.visualstudio.com/spaces/21/index.html

    Please post your question there instead as Azure DevOps is currently not supported on Microsoft Q&A.

    You can also ask for help here https://stackoverflow.com/questions/tagged/azure-devops.

    Thanks

    0 comments No comments

  2. Anonymous
    2022-07-06T04:18:34.067+00:00

    The issue is you're declaring the variable at compile time. Try declaring it at runtime like this: $[variables.major]

    https://learn.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml%2Cbatch#runtime-expression-syntax

    0 comments No comments