Click here to Skip to main content
15,886,545 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am getting below Error while using MEF as a part of my project.

What Could be the issue?



The composition remains unchanged. The changes were rejected because of the following error(s):
The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information.

1) No exports were found that match the constraint:
ContractName SimpleCalculator3.ICalculator
RequiredTypeIdentity SimpleCalculator3.ICalculator

Resulting in: Cannot set import 'SimpleCalculator3.Program.calculator (ContractName="SimpleCalculator3.ICalculator")' on part 'SimpleCalculator3.Program'.
Element: SimpleCalculator3.Program.calculator (ContractName="SimpleCalculator3.ICalculator") --> SimpleCalculator3.Program
Posted

1 solution

The Problem was that i had many parts which needs to be included in container and for that I have to use ImportMany instead of Import

XML
[ImportMany]
        IEnumerable<Lazy<IOperation, IOperationData>> operations;



instead of

XML
[Import]
        IEnumerable<Lazy<IOperation, IOperationData>> operations;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900