fsprojects / SQLProvider

A general F# SQL database erasing type provider, supporting LINQ queries, schema exploration, individuals, CRUD operations and much more besides.
https://fsprojects.github.io/SQLProvider
Other
579 stars 146 forks source link

Does not build in CLI for .net core 3.1 #687

Open ZergRushJoe opened 4 years ago

ZergRushJoe commented 4 years ago

Describe the bug Builds in visual studio 2019 but not using "dotnet build" or in Linux container

ERROR: The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: Could not load type 'System.Data.SqlClient.SqlConnection' from assembly 'System.Data.SqlClient, Version=4.6.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

To Reproduce Steps to reproduce the behavior:

  1. create a new .net core 3.1 F# console project with SQL provider in it and connect to a SQL server database
  2. build using cli dotnet build

Expected behavior builds correctly

Screenshots image

Desktop

Thorium commented 4 years ago

Try adding a reference to System.Data in your project.

ZergRushJoe commented 4 years ago

@Thorium do you mean System.Data.Common or System.Data.SqlClient. I have install both and it still has the same error

ZergRushJoe commented 4 years ago

Project file

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <OutputType>Exe</OutputType>
    ...

  <ItemGroup>
    <PackageReference Update="FSharp.Core" Version="4.7.2" />
  </ItemGroup>

  <ItemGroup>
    ....
    <PackageReference Include="Giraffe" Version="4.1.0" />
    <PackageReference Include="Microsoft.AnalysisServices.AdomdClient.NetCore.retail.amd64" Version="19.4.0.2-Preview" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.5" />
    <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
    <PackageReference Include="SQLProvider" Version="1.1.91" />
    <PackageReference Include="System.Data.Common" Version="4.3.0" />
    <PackageReference Include="System.Data.SqlClient" Version="4.8.1" />
  </ItemGroup>
</Project>
Thorium commented 4 years ago

I guess this is duplicate of #580

Thorium commented 4 years ago

There has been some issues with System.Data.SqlClient on .Net Core 3.1, so there is the dynamic version: https://github.com/fsprojects/SQLProvider/issues/645#issuecomment-639163535