I'm setting up TFS 2015 on-prem and I'm having an issue on my last build step, Publish Build Artifacts. For some reason, the build agent appears to be archiving old binaries and I'm left with a huge filepath:
E:\TFSBuildAgent\_work\1a4e9e55\workspace\application\Development\project\WCF\WCF\obj\Debug\Package\Archive\Content\E_C\TFSBuildAgent\_work\1a4e9e55\workspace\application\Development\project\WCF\WCF\obj\Debug\Package\PackageTmp\bin
I'm copying the files using the example minimatch pattern to begin with:
**\bin
I'm only testing at the moment so this is not a permanent solution but how can I copy all binaries that are in a bin folder but not a descendant of obj?
From research I think that this should work, but it doesn't (It doesn't match anything):
**!(obj)**\bin
I'm using www.globtester.com to test. Any suggestions?
On a separate note, I'll look into the archiving issue later but if anyone has any pointers on it, feel free to comment. Thanks
According to Microsoft's documentation, here is a list of file matching patterns you can use. The most important rules are:
Match with
?
?
matches any single character within a file or directory name (zero or one times).Match with
*
or+
*
or+
matches zero or more characters within a file or directory name.Match with
@
sign@
matches exactly once.Match with Brackets
(
,)
and|
|
it is treated as a logical OR, e.g.*(hello|world)
means "Zero or more occurrances of hello or world"Match with Double-asterisk
**
**
recursive wildcard. For example,/hello/**/*
matches all descendants of/hello
.Exclude patterns with
!
!
changes the meaning of an include pattern to exclude. Interleaved exclude patterns are supported.Character sets with
[
and]
[]
matches a set or range of characters within a file or directory name.Comments with
#
#
are treated as comments.Escaping
[]
can be used to escape literal glob characters in a file name. For example the literal file namehello[a-z]
can be escaped ashello[[]a-z]
.Example
The following expressions can be used in the Contents field of the "Copy Files" build step to create a deployment package for a web project:
Note: You might need to add more extensions, depending on the needs of your project.
In VSTS there are two kinds of pattern matching for URLs that are built-in to the SDKs. Most tasks nowadays use the Minimatch pattern as described in Matt's answer. However, some use the pattern that was used by the 1.x Agent's Powershell SDK. That format is still available in the 2.x Agent's Powershell SDK by the way.
So that means there are 4 kinds of tasks:
find-files
find-match
The ones in bold don't Minimatch, but the format documented in the VSTS-Task-SDK's
find-files
method.The original question was posted in 2015, at which point in time the 2.x agent wasn't yet around. In that case, the pattern would, in all likelihood, be:
The
-:
excludes the items from the ones in front of it.