tags:

views:

49

answers:

1

Is there a way to add exported parts from a catalog to an existing MEF CompositionContainer? I'm aware of ComposeExportedValue extension method, but what if I wanted to add a whole DirectoryCatalog to the list of exports? I don't need recomposition in this case, btw.

+1  A: 

You can call DirectoryCatalog.Refresh to pick up new assemblies in a folder. To add entirely new catalogs, you could pass an AggregateCatalog to the container and then call .Add on AggregateCatalog.Catalogs.

Wim Coenen
I'm surprised I overlooked this. Thanks a lot.
Dmitry Ornatsky