pianomanjh
pianomanjh

Reputation: 217

TFS Build, how to specify multiple wildcard paths, when task uses a searchPattern (Find-Files)

In TFS Build vNext, Build tasks can be used. Many of which take a searchPattern parameter as input, for specifying wildcard paths of files. For example, the VsTest task dictates the following for it's Test Assembly parameter:

Test binaries to run tests on. Wildcards can be used. For example, *test*.dll;-:\obj** for all dlls with test in name while excluding files in any sub-directory named obj.

So, a wildcard for paths to be included is specified, and a wildcard for paths to be excluded is specified.

How can I specify multiple wildcard paths to be included.

Say I want foo.dll but also test.dll, how can this be specified?

I've tried

**\*foo*.dll;**\*test*.dll

but the underlying powershell function Find-Files throws and error:

The path is not of a legal form

Can this be done?

Upvotes: 4

Views: 1966

Answers (2)

Leon Bouquiet
Leon Bouquiet

Reputation: 4372

Yes, this can be done. Depending on which build task you're using, you might need to prepend $(build.sourcesDirectory) (or some other placeholder) to inclusion expressions beyond the first.

I.e. the following should work:

**\*foo*.dll;$(build.sourcesDirectory)**\*test*.dll

See this blog post for the exact details of what is allowed in a wildcard expression.

Upvotes: 2

Vicky - MSFT
Vicky - MSFT

Reputation: 5010

The followings works well on my machine

**\$(BuildConfiguration)\*test*.dll;**\$(BuildConfiguration)\*foo*.dll;-:**\obj\**

Upvotes: 2

Related Questions