I'm using the
AssemblyFile attribute on my
UsingTask to load a task assembly into a separate
AppDomain. I get this error:
error MSB4008: A conflicting assembly for the task assembly "<path I specified in AssemblyFile>" has been found at "<some other path>".
Here’s what happens:
* we load the task type in the default
AppDomain using
LoadFrom * we load the task type in the new
AppDomain using
LoadFrom and marshal it back to the default
AppDomain * unfortunately, CLR tries the Load context first when marshalling the task type back to the default
AppDomain * if CLR finds a matching assembly with a task class in the Load context, we now have incompatible types: original task type in the
LoadFrom context, and freshly marshalled type in the Load context
There’s no way to recover from it once we get incompatible task types, nor there’s a way to somehow tell CLR to use the
LoadFrom context for marshalling.
You could put your task assemblies in the GAC and use the
AssemblyName attribute on
UsingTask to specify the strong name of the assembly. In this case, the engine will consistently locate the assembly using the Load context and there can be no conflicts.