title: Azure DevOps Pipeline ArchiveFiles creates empty archive from build folder
body: <p>I've set up an Azure DevOps build pipeline. Everything is working fine, except for the <code>ArchiveFiles</code> step that should generate the artifact to be published to Azure afterwards.</p>
  
  <p>I'm using the following YAML configuration:</p>
  
  <pre><code>- script: |
      call dist.bat
      tree /A /F
    displayName: 'build'
  
  - task: ArchiveFiles@2
    inputs:
      rootFolderOrFile: $(Build.BinariesDirectory)
      includeRootFolder: true
      archiveType: 'zip'
      archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
      replaceExistingArchive: true
      verbose: true
  </code></pre>
  
  <p>The <code>dist.bat</code> is building the project and placing the resulting archives at <code>dist/</code> in the local directory. The <code>tree</code> command shows that the files are correctly generated and located in the folder.</p>
  
  <pre><code>Finished building distributable exe including resources and dependencies
  Final distributable folder is dist\
  Folder PATH listing for volume Temporary Storage
  Volume serial number is 000000F9 5455:3543
  D:.
  |   .gitignore
  |   azure-pipelines.yml
  |   dist.bat
  |   Main.py
  |   Main.spec
  |   Pipfile
  |   Pipfile.lock
  |   __init__.py
  |   
  +---dist
  |   |   MyApp.exe
  |   |   default.ini
  |   |   User Guide.pptx
  |   |   
  |   \---resources
  |       |   default-german.ini
  |       |   
  |       +---configurations
  |       \---templates
  |               Template_InputData_English.xlsx
  |               
  </code></pre>
  
  <p>When it comes to the <code>ArchiveFiles</code> task, <code>$(Build.BinariesDirectory)</code> is set to <code>dist/</code>. According to the output log, this folder is found. However, it's only an empty directory with 0 files and 0 bytes in it:</p>
  
  <pre><code>[command]d:\a\_tasks\ArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b0\2.159.0\7zip\7z.exe a -tzip -bb3 -mx=5 d:\a\1\a\1487.zip @d:\a\_temp\bfoix61oaayw7eqhcvclahsemi
  
  7-Zip [64] 16.00 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-10
  
  Scanning the drive:
  1 folder, 0 files, 0 bytes
  
  Creating archive: d:\a\1\a\1487.zip
  
  Items to compress: 1
  
  
  Files read from disk: 0
  Archive size: 138 bytes (1 KiB)
  Everything is Ok
  </code></pre>
  
  <p>Is there possibly some configuration error I'm missing? I think it might be related to some path mixup, but it's hard to debug based on the shortened filepaths and missing context information. The following is shown in the debug log for the <code>ArchiveFiles</code> task:</p>
  
  <pre><code>##[debug]agent.workFolder=d:\a
  [...]
  ##[debug]System.DefaultWorkingDirectory=d:\a\1\s
  ##[debug]rootFolderOrFile=d:\a\1\b
  ##[debug]makeAbsolute:d:\a\1\b
  ##[debug]includeRootFolder=true
  ##[debug]archiveType=zip
  ##[debug]archiveFile=d:\a\1\a\1487.zip
  ##[debug]replaceExistingArchive=true
  [...]
  ##[debug]Listing all 1 files to archive:
  ##[debug]b
  ##[debug]Checking for archive destination folder:d:\a\1\a
  ##[debug]Creating archive with 7-zip: d:\a\1\a\1487.zip
  [...]
  ##[debug]exec tool: d:\a\_tasks\ArchiveFiles_d8b84976-e99a-4b86-b885-4849694435b0\2.159.0\7zip\7z.exe
  ##[debug]Arguments:
  ##[debug]   a
  ##[debug]   -tzip
  ##[debug]   -bb3
  ##[debug]   -mx=5
  ##[debug]   d:\a\1\a\1487.zip
  ##[debug]   @d:\a\_temp\bfoix61oaayw7eqhcvclahsemi
  </code></pre>
  
  <p>Thank you for your help!</p>