Include Subdirectories as option for MEF in DirectoryCatalog?

Topics: Prism v4 - Silverlight 4, Prism v4 - WPF 4
Jun 3, 2011 at 1:43 AM

Hi -- I'm a bit on the new side to this stuff, but came across something that I think may be pretty handy if it could be implemented, or maybe someone could suggest a better way for me to do this.

I'm using MEF for module discovery, and often the modules have some external dependencies on third-party DLLs, like Prism, Enterprise Library, and Telerik among possible others.

In order to not keep all of these DLLs in the same directory, and to have a standard location where each developer should be including them, we have setup a simple directory structure for our "helper" DLLs (all under c:\CompApp\vbin\).

In the Bootstrapper.cs, then, we are doing this:

            DirectoryCatalog prism = new DirectoryCatalog(@"C:\CompApp\vbin\Prism\");
            DirectoryCatalog telerik = new DirectoryCatalog(@"C:\CompApp\vbin\Telerik\");
            DirectoryCatalog entlib = new DirectoryCatalog(@"C:\CompApp\vbin\EntLib\");
            DirectoryCatalog catalog = new DirectoryCatalog(@"C:\CompApp\bin\Modules\");


Two things: 

  1. This pattern may not be necessary -- I may have overlooked some different practice I should be following for something like this.  If that's the case, could someone set me straight?
  2. If this pattern does seem ok, it would be pretty nice if we could get an overload on DirectoryCatalog to specify to look in subdirectories for assemblies as well.  Would this be the right place to submit such a suggestion? 

Thanks in advance from a new participant.  I'm really liking working with Prism, and am just getting started with what will end up being a pretty large-scale app.  :)


Jun 3, 2011 at 1:21 PM


The approach you're mentioning seems to be a valid possibility to achieve the scenario you require. You could create a work item in the Issue Tracker suggesting that feature to be added to future versions of Prism.

I hope you find this helpful.

Guido Leandro Maliandi

Jun 3, 2011 at 1:34 PM

Thanks for the feedback.  I've created the work item below for this feature request.