This project has moved and is read-only. For the latest updates, please go here.

Newbie question: One namespace per export?

Sep 16, 2011 at 7:30 PM

Hi.  Am I limited to one namespace per export?  Will it be necessary for Lazy Loading?

Thank you


Sep 16, 2011 at 7:31 PM

Correction:  Limit one Export per namespace?  -- Thanks.

Sep 16, 2011 at 8:28 PM

OK Playing around I see that I cannot export two classes that implement the same interface from the same target directory or namespace and I can export two defferent classes provided they implement different interfaces.


Sep 20, 2011 at 3:20 PM

That is not true. I have one Assembly exporting two Extensions implementing same interface in a same namespace. Could you provide more details on how you're doing it ?

Sep 20, 2011 at 7:40 PM


Import ]

 public IMessageSender MessageSender { get; set ; }


public void Compose()
    var catalog = new DirectoryCatalog(@"C:\Ayal\Exerise\MEFExporter\MEFExporter\bin\Debug");
    var container = new CompositionContainer(catalog);

When the MessageSender is called in Compose(), as MessageSender was defined only according to the interface it ipmlements,

There is a runtime error:

/////////////////////////////////////////////////////////////////////Runtime Exception:

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) More than one export was found that matches the constraint

So, it seems like a no-go.



Sep 20, 2011 at 7:41 PM

fahadash I would love to see your code.  Thanks.