Question: I don't know how to specify correct mask to search for my test assemblies in TFS2010 build definition.
I'm not using default Binaries folder for output assemblies. Each test project has its own bin\Debug or bin\Release output folder.
If I use the default mask \*\*\\*test\*.dll my tests failed with this error:

```
API restriction: The assembly 'file:///E:\Builds\....\obj\Debug\xxx.IntegrationTests.dll' 
has already loaded from a different location. It cannot be loaded from a new location within the same appdomain.

```

This is because \*\*\\*test\*.dll mask will find multiple results for the same assembly in the bin\Debug and obj\Debug folders. 

I tried to change this mask to exclude obj\Debug folder and use bin only:

```
**\bin\Debug\*test*.dll
**\bin\**\*test*.dll
**\Debug\*test*.dll

```

but FindMatchingFiles activity return always 0 results. 

It is working only when I pass full path to the test assembly. 

What is the correct mask if I want to exclude obj\Debug folders from test assembly search?

**WORKAROUND**:  

I'm still using FindMatchingFiles activity, but I had to add Assign activity with following params:  

```
To - testAssemblies
From - testAssemblies.Where(Function(o) Not o.Contains("\obj\")).ToList()

```

I'm filtering all test assemblies found in the "obj" folders this way.

Answer: 
The build activity that is of interest to you is named "Find Test Assemblies":
![enter image description here](https://i.stack.imgur.com/O8nh4.png)

So, what you place at the build definition is concatenated after build script variable `outputDirectory`.

This `outputDirectory` is initialized for each configuration in activity "Initialize OutputDirectory":
![enter image description here](https://i.stack.imgur.com/fzLZU.png)

You can queue a new build where you set your 'Logging Verbosity' equal to `Diagnostic`. Once this has ran (and failed), check for what is going on with your build. 

My guess is that you have issues with your configuration/platform settings, but without concrete input that's just guessing.
Probably the `**` at the beginning of your filter is the problem. The starting point of the search is at a location you would not expect it to be and subdirectories do not contain your test files.

To troubleshoot this problem, please add `..\..\..` to the start of your filter expression. For debugging purposes, this will get out of the subdirectory structure you're in and perform a wider search on your system for the test files. You can also make the first part absolute, to make sure you're searching in the right directory subtrees.

As alternative, you can also run a [processmonitor](http://technet.microsoft.com/en-us/sysinternals/bb896645) session on your build system, to see where your TFS build engine is actually looking for your test assemblies. Or perform some logging in the build workflow / activity itself.

When you have found the problem, narrow your search window again to not search irrelevant subdirectory structures.