Ziggler
Ziggler

Reputation: 3500

Azure DevOps Pipeline Copy Files Task Target Directory Value

I am new to Azure DevOps. I tried many ways but nothing helped. I am trying to create a pipeline which has Copy Files Task. I have folder structure like below

Bin
  Common
    abc.dll

Staging
  Bin
    Common

I want to copy abc.dll from Bin\Common to Staging\Bin\Common

In my Copy Files Task I am giving below

Source: Bin/Common
Contents: *.dll
Target Folder: Staging/Bin/Common

In Advanced:
Clean Target Folder: Check
Overwrite: Check

The Copy File Task succeeds and when I go to my Repo I donot see abc.dll in Staging\Bin\Common folder. In my Copy File Task log I see

Copying D:\a\1\s\Bin\Common\abc.dll to Staging\Bin\Common\abc.dll

I guess it must be

Copying D:\a\1\s\Bin\Common\abc.dll to D:\a\1\s\Staging\Bin\Common\abc.dll

Thanks in advance.

SOLUTION

Thanks to 4c74356b41 for pointing me in right direction. I accepted and marked as answer. As suggested, I created variable and used it like below

Variable Name: BinCommonStagingFolder
Variable Value: $(Build.Repository.LocalPath)\Staging\Bin\Common\

I used the variable in my Copy Files Task like below to copy only files which I need not all files

Source: Bin/Common
Contents: 
abc.dll
abc.pdb
Target Folder: $(BinCommonStagingFolder)

In Advanced:
Clean Target Folder: Check
Overwrite: Check

Upvotes: 2

Views: 9060

Answers (2)

Guillaume Blanchet
Guillaume Blanchet

Reputation: 689

For me, the issue was because I migrated from a Windows pipeline to a Linux one and path separators "\" on Windows hadn't been updated to "/" causing relative paths to be wrongly interpreted.

Upvotes: 0

4c74356b41
4c74356b41

Reputation: 72191

i guess you should add full path, you can use build varible for that:

Target Folder: $(Build.Repository.LocalPath)\Staging\Bin\Common\

this would reference the root of the repo you checked out

Upvotes: 3

Related Questions