VSTS build Copy Files task copies full path to destination

gregsdennis picture gregsdennis · May 10, 2017 · Viewed 7.6k times · Source

I'm using a Copy Files task in a VSTS build to copy the results of a VS project (bin\Release folder) to a subfolder in the staging directory.

Copy Files task

What I expect is that the contents of the bin folder should be in the staging\bin folder:

drop\bin\

but instead it copies the full path to the the destination. So my binaries are all in

drop\bin\src\MySolution\MyProject\bin\Release\

Is there a way to copy just the files in my release folder to the staging folder without copying the full path?

Answer

gregsdennis picture gregsdennis · May 10, 2017

So it turns out I just needed to change my source directory to the folder where the binaries were.

enter image description here

NOTE This only works because I know exactly where the desired files are. If you find this and you're trying to copy from multiple directories, you have a couple options:

  1. Multiple Copy Files tasks
  2. Just deal with the extra directories.