title: Load assembly into child AppDomain and releasing dll file
body: <p>I have child app-domain where I want to load some dll libraries on start-up and release files so that anybody will be able to delete them. </p>
  
  <p>On start-up I do </p>
  
  <pre><code>Loader al = (Loader)domain.CreateInstanceAndUnwrap(
  typeof(Loader).Assembly.FullName,
  typeof(Loader).FullName);
  al.Load(path)
  </code></pre>
  
  <p>for the following class.</p>
  
  <pre><code>class Loader : MarshalByRefObject
  {
      internal void Load(string path)
      {
          Assembly assembly;
          try
          {
              assembly = Assembly.Load(File.ReadAllBytes(path));
          }
          catch (Exception) { return; }
      }
      internal UseType(string fullyQualifiedTypeName)
      {
           Type userType = Type.GetType(fullyQualifiedTypeName);
      }
  }
  </code></pre>
  
  <p>Later I invoke <code>UseType</code> and I get the correct type but I am not able to delete the file any more because it is as if the child app-domain has locked the dll. </p>
  
  <p>Basically what I want to achieve is to cache the assembly file on start-up and later use <code>GetType</code> calls so that the actual dll file will be released.</p>
  
  <p>Is it really possible to achieve something like this ?</p>