0

I'm just moving to TFS vNext. We have been using XAML builds up until now, which were easy to setup, but we are now forced to use the new build framework which is a pain in the neck.

All I want to do is run a build, and get the files from it. I have got the build running but it insists on putting it into a zip file. How can I just get the files from the zip, remove the 5 million empty folders it has in there, and just get the files into a folder? This should be so simple but it's making me pull my hair out!

Thanks in advance.

BuckBuchanan
  • 198
  • 13

1 Answers1

0

According to your description, seems you just want to get build artifacts without folder structure.

With TFS2017update1 and above, VSTS, you could simply check Flatten Folders under Advanced option in Copy Files Task. The easiest solution for now.

enter image description here

This will flatten the folder structure and copy all files into the specified target folder.

For previous version there is no Flatten Folders option. You need to specify the copy root if you want to copy files only without folder structure. You can use $(Build.StagingDirectory) as a target for this. Afterwards use the Publish task with $(Build.StagingDirectory) as copy root and publish everything from this root to the drop.

Detail step and screenshot please take a look at the answer from Eddie in this question: Copy one file in target directory on deploy from visual studio team services

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • Thanks for the reply. The problem with Flatten Folders is that it flattens everything, including the sub folders. All I want is a basic copy function. My solution has the following structure: Project - File.exe - Subfolder1 - Subfolder2 - SubfolderFile.dll But after my files are put in my drop folder I have: a - b -c -d -e -f - Project Folders a to f are basically the source tree structure being copied for no reason. How do I get rid of a to f and just have Project folder in the root? – BuckBuchanan Feb 07 '18 at 07:58
  • @BuckBuchanan You could see the solution2 as I mentioned above, copy the files with some folder structure you need to `$(Build.StagingDirectory)` as a contain. You could also specify **match pattern filters** (one on each line) that you want to apply to the list of files to be copied. Details and samples please refer **content** Argument in https://learn.microsoft.com/en-us/vsts/build-release/tasks/utility/copy-files. Finally publish the `$(Build.StagingDirectory)` to the drop, you will get what you need. – PatrickLu-MSFT Feb 07 '18 at 08:12
  • Hi Patrick. Your response helped me find the answer... I was expecting the new build system to just work, but it seems that you need to go through a fair amount of configuration to make it work, and some of that configuration isn't entirely obvious. Thanks for your response! – BuckBuchanan Feb 26 '18 at 21:25