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?
You can use
String.Format("{0}\**\*.msi;{0}\**\*.exe", SourcesDirectory)
The
FindMatchingFiles
activity'sMatchPattern
property uses theThat 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 aremsiFiles
andexeFiles
, you can usemsiFiles.Concat(exeFiles)
as the input to aForEach
).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
.FindMatchingFiles has some strange search pattern. Here is the code (decompiled using ILSpy) so you can test your search patterns without having to kick off a new build.
It contains a hardcoded root dir at the following location (Z:)
Code: