title: Autofac dynamic assembly binding not working in Azure Functions
body: <p>Not sure how assembly references get resolved in Azure Function but the following code works fine in a console app(I have tried with both .net core console and .net 4.6.1 console). If I try to use the same code in a function app, I would get the error messages I have mentioned in my code comments. I am using latest version (15.10.2046.0) of Functions and Web Job Tools.</p>
  
  <p>Note: I have manually copied myplugin.dll into my function app's bin folder. Same thing I have done with my console app where the same code works.</p>
  
  <pre><code>var assemblyRoot = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
  var pluginPath = Directory.GetFiles(assemblyRoot, $"myplugin.dll").FirstOrDefault();
  
  var pluginAssembly = Assembly.LoadFile(pluginPath);
  
  var builder = new ContainerBuilder(); // I am using Autofac
  builder.RegisterAssemblyTypes(pluginAssembly).AsImplementedInterfaces().SingleInstance();
  
  var container = builder.Build();
   // Here I am getting errors like "Unable to find assembly '&lt;assembly&gt;'. Are you missing a private assembly file?" for various referenced assemblies like automapper, MongoDB.Bson etc.
  
  var plugIn = container.Resolve&lt;IPlugin&gt;(); 
  // Here I am getting "'IPlugIn' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency.'"
  </code></pre>
  
  <p>Any help or insight would be appreciated. Thank you.</p>