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?
13 Answers 13
For me, installing the Microsoft.Bcl.AsyncInterfaces (Nuget package) fixed the issue.
-
1Just the right Answer, Installing this to the project which when compiled and ran gives the problem, solves it :)user9852806– user985280610/03/2021 15:54:30Commented Oct 3, 2021 at 15:54
-
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.
-
I needed this for XrmToolbox. Except I had to bind for Version 7.0.0.0tgolisch– tgolisch12/12/2023 16:57:21Commented Dec 12, 2023 at 16:57
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.
-
3Or upgrade .NET Core to v5. =)Vinicius Bassi– Vinicius Bassi08/18/2021 18:54:38Commented Aug 18, 2021 at 18:54
-
This worked for me.. after clearing all nuget cache from package manager settingayush mishra– ayush mishra09/25/2021 16:46:25Commented Sep 25, 2021 at 16:46
For .Net Core, This problem basically occurs, when we use layered architecture. Just make sure the version of Microsoft.EntityFrameworkCore should be same in all project, wherever it is used.
-
In my case was almost that. I had installed Microsoft.EntityFrameworkCore.InMemory version 5.0.7 which depends on Microsoft.EntityFrameworkCore. So, as you mentioned, as soon as all the projects had the same version the issue was solved.Sebastian Inones– Sebastian Inones06/25/2021 12:33:11Commented Jun 25, 2021 at 12:33
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.
I was able to fix it by removing <Private>True</Private>
from csproj for Microsoft.Bcl.AsyncInterfaces
. Just reinstall this NuGet package
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.
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,
- 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
- Install Microsoft.Bcl.AsyncInterfaces (Nuget package)
Updating the Microsoft.Bcl.AsyncInterfaces assembly via NuGet did everything it needed to do, including adding the bindingRedirect
entries in the appropriate config files.
I also did all the other hygienics. I cleaned my solution, deleted the bin and obj directory entries, and also cleaned my localhost deploy locations.
However, I still got this error. I reviewed the output (my application is a .NET 4.8 MVC Web application, so the web page showed the error log in detail), and I found that it was failing on loading SimpleInjector.
I updated SimpleInjector to the latest version via NuGet and that fixed my error.
Unfortunately, I didn't keep a copy of the error page, so I can't show you what I saw, but the bottom line is to examine the output or log in detail, see if you can find where the application is attempting to load the assembly that is failing, and update that assembly that appears to be calling the load.
I had to restart my production server, which is also my web server for several websites, among other things.
After the restart, I now have a new, different error Error NU1301: Unable to load the service index for source...
What a nightmare NuGet package management is.
I had the similar issue. For me, it was working fine on local, but on the server(dev or QA), it was failing. My project has two solutions - One for Web and the other one is for DB Access. I resolved this issue in below ways.
- Found out that there is a discrepancy of Microsoft.Bcl.AsyncInterfaces - Web solution was having 5.0.0 whereas DB Access solution had 6.0.0 . I upgraded Web Solution's BCL package to 6.0.0
- Found that below dependentAssembly was missing from web.dev and web.qa config files even after installation of BCL interface 6.0.0 nuget package. I manually added this in both config files and it fixed the issue.
Spent a good amount of time as the error was misleading and it says that the version it is looking for is 'Version=1.0.0.0'. Hope this helps. Thanks.
After uprgrade to Net 8 i got this issue. Solved by installing Microsoft.Bcl.AsyncInterfaces 8.0.0
My Entity Framework Core just needed upgraded.
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.10" />
TO
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.2" />
dotnet restore
fix anything?