title: Dynamic dll loading from byte array with dependency management
body: <p>I'm trying to dynamicaly load some C# DLLs on a C# application. I got all the DLL in a <code>byte[]</code> list and I want to load them without writing them to dll file.</p>
  
  <p>My application crashes when I want to use a dll application. 
  It returns me a <code>System.IO.FileNotFoundException</code> because it does not find the dll file.</p>
  
  <p>I use <code>Assembly.Load()</code> on each <code>byte[]</code> dll and it seems to work properly (no crash and the Assembly List count for the  increase) and I load them in the good order (I don't know it it is necessary).</p>
  
  <pre><code>Assembly assembly = Assembly.Load(binDll);
  AssemblyName[] referencedAssembly = assembly.GetReferencedAssemblies();
  foreach (AssemblyName referencedAssemblyName in referencedAssembly)
  {
      if (!loadedDllList.Contains(referencedAssemblyName.Name) &amp;&amp; this.Apps.Where(a =&gt; a.Item1 == referencedAssemblyName.Name).Count() &gt; 0)
      {
          this.loadDll(referencedAssemblyName.Name);
      }
  }
  
  TX.AddInStore.Load(binDll, dllName, null, null); //LOAD DLL on our application
  loadedDllList.Add(dllName);
  </code></pre>
  
  <p>Thank you</p>