Question

Here's the issue... if I use, say a directory catalog in MEF and have some.dll and copy of some.dll, i will get double the exports, even though they are defining the same type, is there a way to resolve this?

EDIT: the problem isn't with this particular issue, this is just an abstract example of a real issue, for instance, if i have an "extensions" folder, and a way to manually import... it's just something that would be nice to handle.

Was it helpful?

Solution

You can do this with a FilteredCatalog (not part of the core MEF distribution.) See the example here: http://mef.codeplex.com/wikipage?title=Filtering%20Catalogs

Rather than selecting from the inner catalogs via Where you may use Distinct. To compare ComposablePartDefinitions for equality the simplest option is to use ToString but casting to ReflectionComposablePartDefinition is also an option.

HTH, Nick

OTHER TIPS

is there a way to resolve this?

Two options come to mind:

  • remove the redundant copy of the assembly
  • don't use a directory catalog. You can add assembly catalogs for each individual assembly, and just leave out the unwanted assemblies.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top