title: Assembly.LoadFile works but AppDomain.Load fails
body: <p>I want to do a simple Extension application that loads extensions at runtime, then chooses one and executes a method in the selected extension based on an interface (not using MAF or MEF etc) but I'm getting weird errors loading the AppDomain. The extension dll and all the dlls next to it in the bin/Debug folder are in a specified folder and I can load the extension dll using <code>Assembly.LoadFile</code> how ever when I try <code>AppDomain.Load</code> I get a <code>FileNotFoundException</code>, can anyone suggest why this would happen? My code is below</p>
  
  <pre><code>var extensionName = loadedExtension.Name;
  var extensionFolder = Path.Combine(extensionsRootDirectory, extensionName);
  if (!Directory.Exists(extensionFolder)) continue;
  
  Assembly assmbl = null;
  IProvider provider = null;
  string assemblyName = null;
  //Find entry point Assembly
  foreach (var filePath in Directory.GetFiles(extensionFolder, "*.dll"))
  {
      try
      {
          assmbl = Assembly.LoadFile(filePath); //This loads the assembly without problems
          var types = assmbl.GetTypes();
          var providerType = (from t in assmbl.GetTypes()
              where t.GetInterface(typeof(IInfonProvider).Name) != null
              select t).FirstOrDefault();
          if (providerType != null)
          {
              assemblyName = assmbl.FullName;
              provider = assmbl.CreateInstance(providerType.FullName) as IInfonProvider;
              break;
          }
      }
      catch (Exception) { /*Continue, will handle problem if no file was loaded from folder*/ }
  }
  
  if (assemblyName != null)
  {
      try
      {                       
          var appDomainSetup = new AppDomainSetup()
              {
                  //ApplicationName = extensionName,
                  //DynamicBase = extensionFolder,
                  ApplicationBase = extensionFolder,
                  PrivateBinPath = extensionFolder
              };
  
          var extensionDomain = AppDomain.CreateDomain(extensionName, AppDomain.CurrentDomain.Evidence, appDomainSetup);
          extensionDomain.Load(assemblyName); //This gives FileNotFoundException - Could not load file or assembly 'CNSProvider,
  Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its
  dependencies. The system cannot find the file specified.
      }
      catch (Exception) { }
  }
  </code></pre>