title: Importing into a Exported object with MEF
body: <p>I'm sorry if this question has already been asked 100 times, but I'm really struggling to get it to work.</p>
  
  <p>Say I have have three projects.</p>
  
  <ul>
  <li>Core.dll
  
  <ul>
  <li>Has common interfaces</li>
  </ul></li>
  <li>Shell.exe
  
  <ul>
  <li>Loads all modules in assembly folder. </li>
  <li>References Core.dll </li>
  </ul></li>
  <li>ModuleA.dll
  
  <ul>
  <li>Exports Name, Version of module. </li>
  <li>References Core.dll</li>
  </ul></li>
  </ul>
  
  <p>Shell.exe has a [Export] that contains an single instance of a third party application that I need to inject into all loaded modules.</p>
  
  <p>So far the code that I have in Shell.exe is:</p>
  
  <pre><code>static void Main(string[] args)
  {
          ThirdPartyApp map = new ThirdPartyApp();
  
          var ad = new AssemblyCatalog(Assembly.GetExecutingAssembly());
          var dircatalog = new DirectoryCatalog(".");
          var a = new AggregateCatalog(dircatalog, ad);
  
          // Not to sure what to do here.
  }
  
  class Test
  {
      [Export(typeof(ThirdPartyApp))]
      public ThirdPartyApp Instance { get; set; }
  
      [Import(typeof(IModule))]
      public IModule Module { get; set; }
  }
  </code></pre>
  
  <p>I need to create a instance of Test, and load <code>Instance</code> with <code>map</code> from the <code>Main</code> method then load the Module from ModuleA.dll that is in the executing directory then [Import] <code>Instance</code> into the loaded module.</p>
  
  <p>In <code>ModuleA</code> I have a class like this:</p>
  
  <pre><code>[Export(IModule)]
  class Module : IModule
  {
      [Import(ThirdPartyApp)]
      public ThirdPartyApp Instance {get;set;}
  }
  </code></pre>
  
  <p>I know I'm half way there I just don't know how to put it all together, mainly with loading up test with a instance of <code>map</code> from <code>Main</code>.</p>
  
  <p>Could anyone help me with this.</p>