Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
336 views
in Technique[技术] by (71.8m points)

tfsbuild - TFS drop, exclude obj folder using minimatch pattern

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\_work1a4e9e55workspaceapplicationDevelopmentprojectWCFWCFobjDebugPackageArchiveContentE_CTFSBuildAgent\_work1a4e9e55workspaceapplicationDevelopmentprojectWCFWCFobjDebugPackagePackageTmpin

I'm copying the files using the example minimatch pattern to begin with:

**in

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)**in

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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:

  • 1.x agent - Powershell SDK
  • 2.x agent - Node SDK
  • 2.x agent - Powershell 1 Backwards compatibility
  • 2.x agent - Powershell 3 SDK - Using find-files
  • 2.x agent - Powershell 3 SDK - Using 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:

 **in$(BuildConfiguration)***;-:**obj**

The -: excludes the items from the ones in front of it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...