'Could not load file or assembly Microsoft.Bcl.AsyncInterfaces

I can not use the SqlType provider due to an issue with Microsoft.Bcl.AsyncInterfaces.
I am using a minimal program with .NET 4.7.2 and F# 4.7.0.0. My Nuget packages contain a reference to:

package id="Microsoft.Bcl.AsyncInterfaces" version="1.0.0" targetFramework="net472"

Severity Code Description Project File Line Suppression State Error FS3033 The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. Details: Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. Das System kann die angegebene Datei nicht finden. TestSqlProvider C:\Users\weism\source\repos\TestSqlProvider\TestSqlProvider\Program.fs 9 Active

What can I do to fix this issue?



Solution 1:[1]

For me, installing the Microsoft.Bcl.AsyncInterfaces (Nuget package) fixed the issue.

Solution 2:[2]

This error also happens when you try using Microsoft.EntityFrameworkCore v5 in a dotnet core v3.1 project. To resolve, down-version Microsoft.EntityFrameworkCore to latest v3 version.

Solution 3:[3]

For .Net Core, This problem basically occur , when we use layered architecture. Just make sure the version of Microsoft.EntityFrameworkCore should be same in all project, wherever it is used.

Solution 4:[4]

I don't use Microsoft.Bcl.AsyncInterfaces at all in my .NET 4.8 project. Some library depends on version 1.0.0.0. I resolved the issue using a binding redirect:

<dependentAssembly>
  <assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
  <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>

Microsoft.Bcl.AsyncInterfaces.dll 5 was copied to Bin after build.

Solution 5:[5]

I think you update package in one layer. for me i worked in project with three layers (api, AdminTool, Data) the AdminTool Layer had a reference to Data Layer i updated all packages in AdminTool only so i had this error i update package also in data layer and api layer so the problem solved. I hope that help you.

Solution 6:[6]

My Entity Framework Core just needed upgraded TO

Solution 7:[7]

Make sure you have unique single version of that dll. Another step would be to add a binding redirect in the app.config as told in the above comments.

Solution 8:[8]

Check in your installed nuget packages--- If version of Microsoft.EntityFrameworkCore and your .net project is different then it can be a problem. Example - If EntityFrameworkCore is at v5.1.5 or higher & your project dotnet core v3.1 project, this can be the issue.

To solve,

  1. down-version Microsoft.EntityFrameworkCore to equal version of project such as v3 version. to down version click on tool in visual studio -->Nuget Package Manager--> Manage Nuget package for Solutions --> click on installed ---> select nuget package which you want to downgrade --> click on uninstall and then select the same nuget package and then install version 3.1.5 or relevent package.

or

  1. Install Microsoft.Bcl.AsyncInterfaces (Nuget package)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sanushi Salgado
Solution 2 Valera
Solution 3
Solution 4 Petter Hesselberg
Solution 5 Omar Nasr Saad
Solution 6 Todd Vance
Solution 7 Ashutosh Kumar
Solution 8 Chandan Dutta