title: How to use Microsoft.Extensions.Logging.Abstraction 5.0.0 with Azure Durable Functions
body: <p>I am working with Azure Functions and I am having a problem that involves the NuGet &quot;Microsoft.Extensions.Logging.Abstractions&quot;. My solution has been running perfectly fine, but recently I added a dependency which depends on &quot;Microsoft.Extensions.Logging.Abstractions 5.0.0&quot;. The project builds fine, but when I run it. the following error appears: &quot;Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=5.0.0.0&quot;.</p>
  <p>I found some information related to this on a <a href="https://github.com/Azure/azure-functions-core-tools/issues/2304" rel="nofollow noreferrer">Github issue</a>. The suggestions that I found were:</p>
  <ol>
  <li>Downgrade &quot;Microsoft.Extensions.Logging.Abstractions&quot; to version 3.1.0. I can't do this, since I have a third-party dependency that references that same NuGet, but with version 5.0.0.</li>
  <li>Upgrade to .NET 5.0. I can't do this, since I need to use Durable Functions, and those are not yet supported in Azure Functions with .NET 5.0.</li>
  </ol>
  <p>I also tried using multiple versions of that same NuGet, but I got the same error (I tried the approach that is mentioned in this <a href="https://stackoverflow.com/questions/5916855/using-multiple-versions-of-the-same-dll">link</a>).</p>
  <p>Is there any way of solving this problem?</p>
  <p>UPDATE:
  I created a minimal example in which the issue can be reproduced. It is located <a href="https://github.com/AlonsoM45/azure-functions-logging-example" rel="nofollow noreferrer">here</a>. The branch <strong>feature/WithLogging3</strong> runs as expected, but the <strong>feature/WithLogging5</strong> fails with the message &quot;'The host has not yet started&quot;. If I enable the option to Break the Debugger with Common Language Runtime Exceptions, I get the error &quot;Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified&quot;.</p>
  <p>It seems that the project only fails when there is an ILogger being injected into a function. For instance, this one (taken directly from Visual Studio 2019 Template for Azure Functions with .NET Core 3.1):</p>
  <pre><code>[FunctionName(&quot;Function1&quot;)]
  public static async Task&lt;IActionResult&gt; Run(
      [HttpTrigger(AuthorizationLevel.Function, &quot;get&quot;, &quot;post&quot;, Route = null)] HttpRequest req,
      ILogger log)
      {
          log.LogInformation(&quot;C# HTTP trigger function processed a request.&quot;);
  
          string name = req.Query[&quot;name&quot;];
  
          string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
          dynamic data = JsonConvert.DeserializeObject(requestBody);
          name = name ?? data?.name;
  
          string responseMessage = string.IsNullOrEmpty(name)
              ? &quot;This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response.&quot;
              : $&quot;Hello, {name}. This HTTP triggered function executed successfully.&quot;;
  
          return new OkObjectResult(responseMessage);
      }
  </code></pre>
  <p>If I remove the injected ILogger (and the line in which the logger is used in the method), then the project runs fine. However, I need to use a logger.</p>
  <p>I know that the example I provided does not include a Durable Function, but it reproduces the issue, and it will reproduce even if you add a Durable Function to the project, or if you replace the current function with a Durable Function that takes an injected ILogger.</p>
  <p>By the way, if it changes anything, I am using Visual Studio 2019 (Enterprise).</p>