title: Share variables across stages in Azure DevOps Pipelines
body: <p>I am trying to figure out how to share custom variables across ADO pipelines in my script. Below is my script with 2 stages.</p>
  
  <p>I am setting the <code>curProjVersion</code> as an output variable and trying to access it from a different stage. Am I doing it right?</p>
  
  <pre><code>stages:
  - stage: Build
    displayName: Build stage
    jobs:
    - job: VersionCheck
      pool:
        vmImage: 'ubuntu-latest'
      displayName: Version Check
      continueOnError: false
      steps:
  
        - script: |
            echo "##vso[task.setvariable variable=curProjVersion;isOutput=true]1.4.5"
          name: setCurProjVersion
          displayName: "Collect Application Version ID"
  
  - stage: Deploy
    displayName: Deploy stage
    dependsOn: Build
    variables:
      curProjVersion1: $[ dependencies.Build.VersionCheck.outputs['setCurProjVersion.curProjVersion'] ]
    jobs:
    - job: 
      steps: 
        - script: |
            echo $(curProjVersion1)
  </code></pre>