title: BuildManager.GetReferencedAssemblies equivalent for non-web applications
body: <p>Compared to <code>AppDomain.GetAssemblies()</code>, <code>BuildManager.GetReferencedAssemblies()</code> (<a href="http://msdn.microsoft.com/en-us/library/system.web.compilation.buildmanager.aspx" rel="noreferrer">System.Web.Compilation.BuildManager</a>) seems a more reliable way to get the assemblies that are referenced by an ASP.NET application at runtime, since <a href="http://msdn.microsoft.com/en-us/library/system.appdomain.getassemblies.aspx" rel="noreferrer">AppDomain.GetAssemblies()</a> only gets "the assemblies that have <em>already</em> been loaded into the execution context of this application domain". </p>
  
  <p>Iterating through all assemblies is an important tool for dynamically registering types at application start-up in your DI container and especially during application start-up, chances are that other assemblies are not loaded (where not needed) yet, and the composition root is the first one that needs them. It is therefore very important to have a reliable method to get the application's referenced assemblies.</p>
  
  <p>Although <code>BuildManager.GetReferencedAssemblies()</code> is a reliable method for ASP.NET applications, I'm wondering: <strong>what alternatives are available for other types of applications</strong>, such as desktop applications, windows services and self-hosted WCF services?</p>