title: StructureMap and scanning assemblies
body: <p>So, I have a .NET solution that uses StructureMap, and I'd like to have StructureMap read an outside assembly that implements an interface from a project in that solution and defines the registry entry for it.</p>
  
  <p>StructreMap configuration for my solution:</p>
  
  <pre><code>ObjectFactory.Initialize(registry =&gt;
  {
    registry.Scan(assembly =&gt;
     {
       assembly.TheCallingAssembly();
  
       //Telling StructureMap to sweep a folder called "extensions" directly
       //underneath the application root folder for any assemblies found in that folder
       assembly.AssembliesFromPath("extensions", addedAssembly =&gt; addedAssembly.GetName().Name.ToLower().Contains("extension"));
  
       //Direct StructureMap to add any Registries that it finds in these assemblies, assuming that all the StructureMap directives are
       //contained in registry classes
       assembly.LookForRegistries();
     });
  });
  </code></pre>
  
  <p>Pretty straightforward, I tell it to add the calling assembly and the assembly from a directory to the assemblies collection.  I've debugged the assemblies variable and it has indeed found all the assemblies (including the one from the extensions directory).</p>
  
  <p>In a DLL project I've created separate from my original solution, I have an implementation of an interface (I've referenced the interfaces project from my original solution), and written a very simple registry:</p>
  
  <pre><code>public class ProductMockRegistry : Registry
  {
      public ProductMockRegistry()
      {
          ForRequestedType&lt;IProductRepository&gt;().AddInstances(repository =&gt;
          {
              repository.OfConcreteType&lt;ProductMockRepository&gt;();
          });
      }
  }
  </code></pre>
  
  <p>The problem I have is, StructureMap does not find the registry in the external DLL.  It finds the DLL just fine, but when I tell it to LookForRegistries, it doesn't find it.</p>