I’m facing a problem with my unit tests not running in my TFS Build Machine, although they are running on my developer machine.
I get an exception on the following line, trying to load all my loaded assemblies for a specific interface:
var classesToMap = AppDomain.CurrentDomain.GetAssemblies().ToList()
.SelectMany(s => s.GetTypes())
.Where(p => typeof(IInterface).IsAssignableFrom(p) && p.IsClass).ToList();
The exception is:
System.Reflection.TargetInvocationException: Exception has been thrown
by the target of an invocation. —>
System.Reflection.ReflectionTypeLoadException: Unable to load one or
more of the requested types. Retrieve the LoaderExceptions property
for more information..
Any idea why?
Got this fixed by adding a condition to discard all dlls which are in the GAC:
It’s a work around but does the work for me.
Thanks for the hint.