SQLProvider icon indicating copy to clipboard operation
SQLProvider copied to clipboard

Does not build in CLI for .net core 3.1

Open ZergRushJoe opened this issue 5 years ago • 5 comments
trafficstars

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

  • OS: windows 10

ZergRushJoe avatar Jul 24 '20 15:07 ZergRushJoe

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

Thorium avatar Jul 24 '20 16:07 Thorium

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

ZergRushJoe avatar Jul 24 '20 17:07 ZergRushJoe

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>

ZergRushJoe avatar Jul 24 '20 19:07 ZergRushJoe

I guess this is duplicate of #580

Thorium avatar Jul 24 '20 19:07 Thorium

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

Thorium avatar Sep 03 '20 18:09 Thorium