Running Unit Tests When TFS Build Definition Output Location is AsConfigured

I only just recently noticed that no tests were running for a couple of build definitions whose Output location was set to AsConfigured. I have a good reason to have the build definition set this way, but that is beside the point. The point is that the regular pattern set in Test source spec **\*test*.dll;**\*test*.appx was not finding any test libraries. Well, that's because the root folder defined by that pattern is the \bin folder for the build agent when what you need it to look in is the \src folder. I found the quick fix for this Y. Shoham on stackoverflow. Use the following pattern in the Test source spec field of your build definition:

..\src\**\*test*.dll;..\src\**\*test*.appx

Now it should be able to find all test libraries when the Output location of your build definition is set to AsConfigured.

Disregard everything I wrote. You will have a problem where test libraries in the obj folder will be run too, and those tests will fail. I have not been able to find a way to easily exclude the obj folder from the path I specify. I am forced to build all solution projects to one folder for now just like the Output location values SingleFolder and PerProject produce.