Composing Modules in separate Dlls

Apr 20, 2010 at 8:21 PM

Hi all,

 

I'm trying to configue MEF working in my project .

 

I have a contract class lybrary project , there I declare my interfaces .

 

I build a new class library project for each Iterface implementation in the contracts project .

 

Then I started using the contractes on the other application parts.

 

When I host MEF in my WPF app class , I doesn't compose any thig when it should do.

 

I reality , I'm using Prism to add modules . In each module I use import for any of the contactes I have.

 

This is my Hosting code :

 

 

<font face="Consolas" size="2" color="#0000ff">

var

</font>

 

aggregateCatalog = new AggregateCatalog

();<font face="Consolas" size="2">

aggregateCatalog.Catalogs.Add(

</font>

new AssemblyCatalog(typeof(App

).Assembly));<font face="Consolas" size="2">

aggregateCatalog.Catalogs.Add(

</font>

new DirectoryCatalog(@".\Modules\", "*.exe"

));<font face="Consolas" size="2">

 

</font>

var container = new CompositionContainer

(aggregateCatalog);<font face="Consolas" size="2">

container.ComposeParts(

</font>

this);

I saw in the debugger that the cataloge has 0 parts to compose . What can be the problem ?

Please help... 

 

 

 

var  aggregateCatalog = new AggregateCatalog

 

();

 

aggregateCatalog.Catalogs.Add(

 

new AssemblyCatalog(typeof(App

).Assembly));

 

aggregateCatalog.Catalogs.Add(

 

new DirectoryCatalog(@".\Modules\", "*.exe"

));

 

 

var container = new CompositionContainer

(aggregateCatalog);

 

 

container.ComposeParts(

 

this

);

 

 

 

 

 



Developer
Apr 20, 2010 at 11:59 PM

Any reason you are creating a DirectoryCatalog that only looks for *.exe files? I'm assuming that your modules are actually *.dll files in which case you might want to update your DirectoryCatalog parameters.