最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

azure devops - CopyFiles Task Doesn't Find Files in BinariesDirectory - Stack Overflow

matteradmin5PV0评论

I have an Azure DevOps pipeline that builds an Android bundle. After the task that builds my app, there are two tasks as below. Log of the first one shows that $(Build.BinariesDirectory) folder contains MyApp.aab and MyApp-Signed.aab. But the second task doesn't find anything and copies 0 files.

Any ideas why it is happening? I've tried everything including hard-coding /Users/runner/work/1/b/MyApp-Signed.aab which is the actual path from log of previous tasks.

- task: Bash@3
  inputs:
    targetType: 'inline'
    script: 'ls'
    workingDirectory: '$(Build.BinariesDirectory)'
  
- task: CopyFiles@2
  inputs:
    Contents: '$(Build.BinariesDirectory)/*.aab'
    TargetFolder: '$(Build.ArtifactStagingDirectory)'
    OverWrite: true
    flattenFolders: true

I have an Azure DevOps pipeline that builds an Android bundle. After the task that builds my app, there are two tasks as below. Log of the first one shows that $(Build.BinariesDirectory) folder contains MyApp.aab and MyApp-Signed.aab. But the second task doesn't find anything and copies 0 files.

Any ideas why it is happening? I've tried everything including hard-coding /Users/runner/work/1/b/MyApp-Signed.aab which is the actual path from log of previous tasks.

- task: Bash@3
  inputs:
    targetType: 'inline'
    script: 'ls'
    workingDirectory: '$(Build.BinariesDirectory)'
  
- task: CopyFiles@2
  inputs:
    Contents: '$(Build.BinariesDirectory)/*.aab'
    TargetFolder: '$(Build.ArtifactStagingDirectory)'
    OverWrite: true
    flattenFolders: true
Share Improve this question asked Nov 17, 2024 at 6:02 Delphi.BoyDelphi.Boy 1,2264 gold badges20 silver badges41 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I found the solution. The missing piece was SourceFolder. By default it is set to $(Build.SourcesDirectory) so it couldn't find the .aab files. The working version is:

- task: CopyFiles@2
  inputs:
    Contents: '*.aab'
    SourceFolder: '$(Build.BinariesDirectory)'
    TargetFolder: '$(Build.ArtifactStagingDirectory)'
    OverWrite: true
    flattenFolders: true
Post a comment

comment list (0)

  1. No comments so far