21
votes

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?

8
The English translation of "Das System kann die angegebene Datei nicht finden" is "The system cannot find the file specified".rmunn
Are you using .net core? If so does the command dotnet restore fix anything?VoronoiPotato
If it's still an issue, can you post csproj of this app?Mike Twc

8 Answers

9
votes

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

7
votes

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.

5
votes

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.

2
votes

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.

2
votes

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.

0
votes

My Entity Framework Core just needed upgraded TO

0
votes

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.

0
votes

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)