title: Executing installers from all the assemblies in the application
body: <p>I'm trying to create an <code>IWindsorContainer</code> factory that executes all the installers packaged with the application (i.e. everything in the <code>bin</code> folder)</p>
  
  <p>It needs to work for:</p>
  
  <ol>
  <li>A Windows client application (that might or might not be installed with Clickonce)</li>
  <li>A Windows service</li>
  <li>A NUnit-based integration test suite (that might be run with R# while developing)</li>
  <li>An ASP.NET MVC application</li>
  </ol>
  
  <p><code>FromAssembly.InThisApplication()</code> will not work, as this is not the "root" assembly (there might not even <em>be</em> a root assemly)</p>
  
  <p>My first, naïve implementation was:</p>
  
  <pre><code>return new WindsorContainer()
             .Install(
                 FromAssembly.InDirectory(
                      new AssemblyFilter(
                          Path.GetDirectoryName(
                              Assembly.GetExecutingAssembly()
                                      .Location))));
  </code></pre>
  
  <p>This worked fine for 1 and 2, but not the rest.</p>
  
  <p>Then I tried with:</p>
  
  <pre><code>return new WindsorContainer()
             .Install(
                 FromAssembly.InDirectory(
                      new AssemblyFilter(
                          Path.GetDirectoryName(
                              new Uri(
                                  Assembly.GetExecutingAssembly()
                                          .CodeBase)
                                  .LocalPath))));
  </code></pre>
  
  <p>Which works at least for ASP.NET, but will likely break shadow copying.</p>
  
  <p>Do I have a better alternative that supports shadow copy scenarios?</p>
  
  <p>Or should I forget the whole idea and run <code>Install(FromAssembly.InThisApplication())</code> from the entry point assembly, making sure all the references are explicit?</p>
  
  <hr>
  
  <p>Additional information:</p>
  
  <p>This code is part of <code>MyCompany.DI</code>, a library shared by different project types that contains... well, DI related stuff, installers for things that are used everywhere (<code>GenericFactoryInstaller</code>, for example), etc.</p>
  
  <p>Other installers are contained in specific root projects, or libraries (for example, <code>MyCompany.Data</code> contains a <code>NHInstaller</code> that finds a method returning the NH configuration as uses it to create the session factory)</p>
  
  <p>Put another way, this "meta-installer" should find all the installers <em>in the current application</em> and run them. I'm just trying to find a way to avoid copy&amp;paste.</p>