title: Azure Devops Pipelines - connect "VS Build" step to "Archive Files" step
body: <p>I'm trying to get into using Azure Devops Pipelines, and my first pet project is a simple .NET command line app I'm trying to get to be built.</p>
  
  <p>I picked the "VS Build .NET Desktop" task template, and the build per se works fine - the bits are compiled without trouble</p>
  
  <p>YAML:</p>
  
  <pre><code>- task: VSBuild@1
    inputs:
      solution: '$(solution)'
      platform: '$(buildPlatform)'
      configuration: '$(buildConfiguration)'
  </code></pre>
  
  <p>Log:</p>
  
  <pre><code>##[section]Starting: VSBuild
  ==============================================================================
  Task         : Visual Studio build
  Description  : Build with MSBuild and set the Visual Studio version property
  Version      : 1.151.2
  Author       : Microsoft Corporation
  Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/visual-studio-build
  ==============================================================================
  
  ##[command]"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" "d:\a\1\s\AzureDevopsTaskCreator.sln" 
  ...(lots of lines omitted)
  CopyFilesToOutputDirectory:
    Copying file from "d:\a\1\s\obj\Release\AZTaskCreator.exe" to "d:\a\1\s\bin\Release\AZTaskCreator.exe".
    AZTaskCreator -&gt; d:\a\1\s\bin\Release\AZTaskCreator.exe
    Copying file from "d:\a\1\s\obj\Release\AZTaskCreator.pdb" to "d:\a\1\s\bin\Release\AZTaskCreator.pdb".
  </code></pre>
  
  <p>But now I wanted to somehow publish the output from this build so I could download it (or deploy it somewhere). But I've been struggling with getting these things hooked up.</p>
  
  <p>So I tried to first zip the build output into an archive (which could then be published):</p>
  
  <p>YAML</p>
  
  <pre><code>- task: ArchiveFiles@2
    inputs:
      rootFolderOrFile: '$(Build.BinariesDirectory)'
      includeRootFolder: true
      archiveType: 'zip'
      archiveFile: '$(Build.ArtifactStagingDirectory)/AZCreateTasks$(Build.BuildId).zip'
      replaceExistingArchive: true
      verbose: true
  </code></pre>
  
  <p>Log:</p>
  
  <pre><code>##[section]Starting: ArchiveFiles  
  ##[command]d:\a\_tasks\ArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b0\2.151.2\7zip\7z.exe a -tzip -bb3 d:\a\1\a\AZCreateTasks8.zip @d:\a\_temp\yat6561e8redmiomp7bbuik9
  </code></pre>
  
  <p>My problem is: <strong>HOW</strong> can I tell the "Archive Files" step to use the <strong>output directory</strong> of the previous build? I was assuming that the default <code>$(Build.BinariesDirectory)</code> would do that - but obviously, it doesn't:</p>
  
  <ul>
  <li>Output from VS Build goes to the <code>d:\a\1\s\bin\Release\</code> directory</li>
  <li>Archive files step zips up files in <code>d:\a\_temp\yat6561e8redmiomp7bbuik9</code> directory</li>
  </ul>
  
  <p>How can I "connect" these two steps so that the "Archive Files" step actually respects and uses the output directory of the VS Build step?? </p>
  
  <p>I'm having a terribly hard time finding any useful documentation on what kind of "system pre-defined" magic variables are in play here, and how to influence these .....</p>