Recursively Finding Files in TFS Build 2010



One of my favorite new build workflow activities is the FindingMatchingFiles activity.  It’s an activity that is provided out of the box for use during Team Build that returns an IEnumerable<string> of all of the files that match a particular wild card string.

It’s available in the toolbox under the Team Foundation Build Activities tab.  The full name of the activity is:  Microsoft.TeamFoundation.Build.Workflow.Activities.FindMatchingFiles.

TFS 2010 Build Workflow Activities Toolbox

Here is a typical usage if you are looking for all .CSS files in a particular folder.

TFS 2010 Build Workflow FindMatchingFiles Activity

The problem I was attempting to solve is how to find all of the files recursively in all of the subfolders as well.  All I had to do was change the match pattern argument to include a “**” in front of the original pattern and it worked like a charm!

TFS 2010 Build Workflow FindMatchingFiles Activity

Ed Blankenship



Saturday, 17 September 2011 04:05:54 (Pacific Daylight Time, UTC-07:00)
Thanks Ed - that saved a fair amount of effort debugging how to get a Test Spec to search recursively!
Thursday, 20 February 2014 15:39:14 (Pacific Standard Time, UTC-08:00)
How do you set the directory so that file specs such as "pattern1.c;pattern2.h" work?
It's a bit of a pain having to split it up and add the directory name to the beginning of each pattern segment.
Dylan
Name
E-mail
(will show your gravatar icon)
Home page

Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, strike, strong, sub, sup, u) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

[Captcha]Enter the code shown (prevents robots):

Live Comment Preview