I'm trying to use the SQLProvider for MS SQL Server with F#, but it appears that it's not possible with the recommended setup.
See my module below:
namespace MyApp
open FSharp.Data.Sql
module Database =
[<Literal>]
let dbVendor = Common.DatabaseProviderTypes.MSSQLSERVER
[<Literal>]
let connString =
"Data Source=localhost;Database=MyDatabase;User Id=user;Password='my-password-here'"
[<Literal>]
let indivAmount = 1000
[<Literal>]
let useOptTypes = true
type sql = SqlDataProvider<dbVendor, connString, IndividualsAmount=indivAmount, UseOptionTypes=useOptTypes>
My main problem is that after adding in this code I get this message/warning in intellisense
The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: System.Data.SqlClient is not supported on this platform.F# Compiler(3033)
and a build error when attempting to compile:
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
All projects are up-to-date for restore.
C:\Development\F#\MyApp\DataTypes.fs(21,16): error FS3033: The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: System.Data.SqlClient is not supported on this platform. [C:\Development\F#\MyApp\MyApp.fsproj]
C:\Development\F#\MyApp\DataTypes.fs(21,16): error FS3033: The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: System.Data.SqlClient is not supported on this platform. [C:\Development\F#\MyApp\MyApp.fsproj]
Build FAILED.
C:\Development\F#\MyApp\DataTypes.fs(21,16): error FS3033: The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: System.Data.SqlClient is not supported on this platform. [C:\Development\F#\MyApp\MyApp.fsproj]
C:\Development\F#\MyApp\DataTypes.fs(21,16): error FS3033: The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: System.Data.SqlClient is not supported on this platform. [C:\Development\F#\MyApp\MyApp.fsproj]
0 Warning(s)
2 Error(s)
Time Elapsed 00:00:06.21
Is there something that I'm doing wrong, or is this really just not possible to use the default setup along with latest .NET and F# and I need to submit a git issue? Any insights and critiques welcomed, thanks!
In use at the time of posting:
- .NET 6
- VS Code (1.62.2)
- Ionide (v5.9.0)
- SQLProvider Version 1.2.10
- System.Data.SqlClient Version 4.8.3