Open
Description
Description
I'm trying to compile my project via dotnet build
, but it cannot load the System.Data.SqlClient
assembly. Wierdly enough, it does compile on Visual Studio 2019 and Intellisense works as well.
Repro steps
-
dotnet new console -lang F#
-
dotnet add package SQLProvider
-
Add this code:
module Foobar
open FSharp.Data.Sql
let [<Literal>] ConnString = "ValidConnString"
type private DB = SqlDataProvider<DatabaseVendor = Common.DatabaseProviderTypes.MSSQLSERVER,
ConnectionString = ConnString,
UseOptionTypes = true>
let private ctx = DB.GetDataContext()
And this is the .fsproj
:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="src/Foobar.fs" />
<Compile Include="src/Program.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="SQLProvider" Version="1.1.65" />
<PackageReference Include="Suave" Version="2.5.5" />
<PackageReference Include="System.Data.SqlClient" Version="4.6.1" />
</ItemGroup>
</Project>
dotnet build
Expected behavior
Load properly the assembly.
Actual behavior
# Roughly translation...
C:\Users\Iuri L. Machado\Documents\Projects\hub\EventLogger\src\Capturer\Ability.fs(8,19): error FS3033: The Type Provider 'FSharp.Data.Sql.SqlTypeProvider' related an error: Could not load file or assembly 'System.Data.SqlClient, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the given file. [C:\Users\Iuri L. Machado\Documents\Projects\hub\EventLogger\EventLogger.fsproj]
Known workarounds
I've tried the recommended workarounds, such as, copying the DLL to the given destination dir, but without success.
Related information
- SQLServer
- Happens on Windows/Linux/Mac
- .NET Core 2.2