Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use MatchPattern property of FindMatchingFiles workflow activity

I'm customizing the default workflow of build process template using TFS 2010 Team Build. There is an activity named FindMatchingFiles allows to search for specific files with a pattern defined in MatchPattern property. It works if I only specify one file extension. Example:

String.Format("{0}\\**\\\*.msi", SourcesDirectory)

But I would like to include *.exe as well. Trying following pattern but it doesn't work:

String.Format("{0}\\**\\\*.(msi|exe)", SourcesDirectory)

Anyone could show me how to correct it?

like image 821
jcha Avatar asked Dec 24 '10 07:12

jcha


2 Answers

You can use String.Format("{0}\**\*.msi;{0}\**\*.exe", SourcesDirectory)

like image 149
Maxim Kapitonov Avatar answered Nov 24 '22 17:11

Maxim Kapitonov


The FindMatchingFiles activity's MatchPattern property uses the

Syntax that is supported by the searchPattern argument of the Directory.GetFiles(String, String) method.

That means that you can't combine multiple extensions. You'll need to call the FindMatchingFiles activity twice. You can then combine the results of those two calls when you use them (i.e. if your results are msiFiles and exeFiles, you can use msiFiles.Concat(exeFiles) as the input to a ForEach).

However, as you can see with @antwoord's answer, the activity does actually seem to accept a semi-colon delimited list of patterns, unlike Directory.GetFiles.

like image 20
bdukes Avatar answered Nov 24 '22 16:11

bdukes