I'm trying to piece together examples and put together a base solution as a template for building modular Silverlight applications.
I'm using MEF.
I'm using a ModulesCatalog.xaml file to load my modules. Right now there is only 1 module and it's name is module1.
In module1, I found if I didn't override the ConfigureAggregateCatalog, none of my Exports are available in the Module1.xap file.
So I had to override the ConfigureAggregateCatalog as follows:
AggregateCatalog _aggregCat = new AggregateCatalog();
foreach (var module in this.ModuleCatalog.Modules)
CompositionHost.Initialize(_aggregCat); //add the current XAP.
Here is the code for CreateCatalog I got from the samples:
private DeploymentCatalog CreateCatalog(string uri)
var catalog = new DeploymentCatalog(uri);
catalog.DownloadCompleted += (s, e) => DownloadCompleted(s, e);
private void DownloadCompleted(object sender, AsyncCompletedEventArgs e)
if (e.Error != null)
StringBuilder _sb = new StringBuilder();
_sb.Append(@"Bootstrapper Module Load Exception: \r\n");
if (e.Error.InnerException != null)
In doing this, I now have a problem in the bootstrapper in the CreateShell()
protected override DependencyObject CreateShell()
I get an exception that the Shell contract is not found though it is exported in the base silverlight project.
So I have to go back to the ConfigureAggregateCatalog function and and add this code.
The problem with doing this I have IPopupController and ILogService I export in the base object and they are getting registered 2 times. So I'm not understanding why the GetExportedValue<Shell> is failing when it is in fact registered.