I am missing something basic when it comes to using MEF. I got it working using samples and a simple console app where everything is in the same assembly. Then I put some imports and exports in a separate project which contains various entities. I want to use these entities in an MS Test, but the composition is never actually done. When I move the composition stuff into the constructor of an entity in question it works, but that’s obviously wrong. Does GetExecutingAssembly only “see” the test process? What am I missing re containers? I tried putting the container in a Using in the test without luck. The MEF docs are still very scant and I can’t find a simple example of an application (or MS Test) which uses entities from a different project…
Share
In .NET, each exe or DLL file is called an assembly1. So when you build a catalog based on the “executing assembly” and use it at the application entry point, then you only include parts which are defined within the exe project. You don’t get any parts defined in the DLLs.
Try replacing this:
by this:
edit: I just discovered that there is a simpler solution:
(1) Actually, an assembly can consist of multiple files but this is rarely used. The term is also used for side-by-side COM.