Copy one file in target directory on deploy from visual studio team services

后端 未结 7 2313
天命终不由人
天命终不由人 2020-11-28 08:46

I\'m using VSTS as a build server, and while building I want to copy the bin folder contents to the root of the target, and also custom files from another folder to this tar

7条回答
  •  清酒与你
    2020-11-28 09:32

    The "flattenFolders" option is also available as a YAML task parameter. The following code excerpt shows a CopyFiles@2 task which copyies the build output to the $(Build.ArtifactStagingDirectory). When I specify the option flattenFolders: true the nested folder structure bin\release\...\My.exe is flattened, means the exe files is copied to the root of $(Build.ArtifactStagingDirectory).

    - task: CopyFiles@2
      displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
      inputs:
        SourceFolder: '$(system.defaultworkingdirectory)'
        Contents: |
         **\bin\$(BuildConfiguration)\**\*.exe
        TargetFolder: '$(Build.ArtifactStagingDirectory)'
        flattenFolders: true
    

    Further documentation concerning the CopyFiles task can be found here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/copy-files?view=vsts&tabs=yaml

提交回复
热议问题