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:
?
?
matches any single character within a file or directory name (zero or one times).*
or +
*
or +
matches zero or more characters within a file or directory name. @
sign@
matches exactly once.(
, )
and |
|
it is treated as a logical OR, e.g. *(hello|world)
means "Zero or more occurrances of hello or world"**
**
recursive wildcard. For example, /hello/**/*
matches all descendants of /hello
.!
!
changes the meaning of an include pattern to exclude. Interleaved exclude patterns are supported.[
and ]
[]
matches a set or range of characters within a file or directory name. #
#
are treated as comments.[]
can be used to escape literal glob characters in a file name. For example the literal file name hello[a-z]
can be escaped as hello[[]a-z]
.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:
**\?(.config|.dll|*.sitemap)
**\?(.exe|.dll|.pdb|.xml|*.resx)
**\?(.js|.css|.html|.aspx|.ascx|.asax|.Master|.cshtml|*.map)
**\?(.gif|.png|.jpg|.ico|*.pdf)
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 5 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:
**\bin\$(BuildConfiguration)\**\*;-:**\obj\**
The -:
excludes the items from the ones in front of it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With