More than one export was found that matches the constraint
When using MEF, you might one day find a class that is marked as export is not exported. Having a look at the trace window in VS, there is a line as:
More than one export was found that matches the constraint:
Resulting in: Cannot set import ‘YYYY..ctor (Parameter=”operand1″, ContractName=”XXXX”)’ on part ‘YYYY’.
As the text suggested that there is more than one export of a class. There might be a genuine duplicated export if you try to export a type twice, but not in my case. I only declared it in one assembly.
The cause in my case is the assembly that has my export was deployed to more than one folders, and all those folders are scanned for import.
That alone does not cause more than one export complaint, it only happens when XXXX is a parameter by ImportingConstructor, in my example it is a parameter for YYYY.