2

According to many different SO-questions, it should be possible to exclude files being copied/deployed using the Task "Copy and Publish Build Artifacts" in the new TFS build system.

However it doesn't work for me (it is not excluding anything). What could I be doing wrong:

enter image description here

Community
  • 1
  • 1
bitbonk
  • 48,890
  • 37
  • 186
  • 278

3 Answers3

1

This should work (I know the question is old but I needed an answer myself)

**\!(System.Windows.Interactivity.resources.dll|*.dll.config|*fluentassertions*)

Steve Harris
  • 5,014
  • 1
  • 10
  • 25
0

This is a known issue of the build task “Copy and Publish Build Artifacts”,bitbonk.

Q: This step didn't produce the outcome I was expecting. How can I fix it?

This step has a couple of known issues:

  • Some minimatch patterns don't work.
  • It eliminates the most common root path for all paths matched.

Source Link: Utility: Copy and Publish Build Artifacts

Well, it's nothing business with your settings of minimatch. It's just not work for that build task. Certainly, you can also doulbe check your minimatch with Copy Files task to verify this.

For now, you can avoid these issues by instead using the Copy Files step and the Publish Build Artifacts step.

Note: If it's still not working on copy files step, you should pay attention to the architecture of file when using minimatch. There must be something wrong on it.

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
0

The task copies the files base on the contents you entered one line by one line and the "!" only exclude the files during the copy, it does not delete the files that already been copied. So with the "**\*" you entered in the first line, all the files have already been copied and published. You need to remove the first line in "Contents". And for the excluded files, if there are in the same folded, you need to exclude them in one line. For example: using

!?(1.txt|2.txt) 

to exclude both 1.txt and 2.txt file instead of using

!1.txt
!2.txt
AlignedDev
  • 8,102
  • 9
  • 56
  • 91
Eddie Chen - MSFT
  • 29,708
  • 2
  • 46
  • 60
  • I have tried a lot of different combinations, I tried `!?(**\System.Windows.Interactivity.resources.dll|**\*.dll.co‌​nfig|**\*fluentasser‌​tions*)` I tried `!+(**\System.Windows.Interactivity.resources.dll|**\*.dll.co‌​nfig|**\*fluentasser‌​tions*)` I tried `**\!(System.Windows.Interactivity.resources.dll|*.dll.config|*fluentassertions*)` I tried `**\!(System.Windows.Interactivity.resources.dll|*.dll.config|*fluentassertions*)` I tried `**\!?(System.Windows.Interactivity.resources.dll|*.dll.config|*fluentassertions*)`. It either excludes nothing or everything but never just the files specified – bitbonk Jan 05 '17 at 17:08