title: How to utilise Event aggregator in MEF?
body: <p>I am running the latest PRISM 4.2. Unfortunately the Event Aggregator tutorial in the documentation is driven via Unity instead of MEF. And I can't get it running under MEF.</p>
  
  <p><strong>App.xaml.cs</strong></p>
  
  <pre><code> public partial class App : Application
      {
          [Import]
          public IEventAggregator eventAggregator;
  
          protected override void OnStartup(StartupEventArgs e)
          {
              base.OnStartup(e);
  
              Bootstrapper bootstrapper = new Bootstrapper();
              bootstrapper.Run();
          }
      }
  </code></pre>
  
  <p><strong>Bootstrapper.cs</strong></p>
  
  <pre><code>public class Bootstrapper : MefBootstrapper
      {
          protected override DependencyObject CreateShell()
          {
              return new MainWindow();
          }
  
          protected override void InitializeShell()
          {
              base.InitializeShell();
              App.Current.MainWindow = (Window)Shell;
              App.Current.MainWindow.Show();
          }
  
          protected override void ConfigureAggregateCatalog()
          {
              base.ConfigureAggregateCatalog();
  
              AggregateCatalog.Catalogs.Add(new AssemblyCatalog(this.GetType().Assembly));
          }
  
          protected override IModuleCatalog CreateModuleCatalog()
          {
              ModuleCatalog moduleCatalog = new ModuleCatalog();
  
              return moduleCatalog;
          }
  
      }
  </code></pre>
  
  <p><strong>MainWindow.xaml.cs</strong></p>
  
  <pre><code>public partial class MainWindow : Window, IView
      {
          public MainWindow()
          {
              InitializeComponent();
              DataContext = new MainViewModel();
          }
      }
  </code></pre>
  
  <p><strong>MainViewModel.cs:</strong></p>
  
  <pre><code>[ModuleExport(typeof(MainViewModel))]
      public class MainViewModel : BindableBase, IServiceCallback
      {
          [Import]
          public IEventAggregator eventAggregator;
  
          [ImportingConstructor]
          public MainViewModel()
          {            
              eventAggregator.GetEvent&lt;AppExitEvent&gt;().Publish("");
  
          }
       }
  </code></pre>
  
  <p>Despite the <code>[import]</code> the event aggregator is always null both in App.xaml.cs and in MainViewModel. Why is that?<br>
  The second question is do I have to export my Viewmodels as a module (as I did above) to use an even aggregator inside them?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>Proof that latest version of <a href="http://compositewpf.codeplex.com/releases/view/117297" rel="noreferrer">PRISM</a> doesn't support <code>ComposeExportedValue</code> anymore.</p>
  
  <p><img src="https://i.stack.imgur.com/k4z5p.png" alt="enter image description here"></p>
  
  <blockquote>
    <p>'System.ComponentModel.Composition.Hosting.CompositionContainer' does
    not contain a definition for 'ComposeExportedValue' and no extension
    method ...</p>
  </blockquote>