WebSharper itself doesn't reference System.Data.Client, so there shouldn't be any direct clash. That being said, I remember having had a lot of trouble getting SQLProvider to work on a .NET Core project, although I unfortunately don't remember the specifics.

One thing to note is that since SQLProvider is a type provider, it needs to load the database driver assembly during compilation, and not just during runtime. So you need to make sure that it can do that. Here WebSharper has some influence, since it replaces the compiler. By default it runs the compiler on .NET Framework / Mono if compiling a .NET Framework assembly, or on .NET Core if compiling a .NET Core or .NET Standard assembly. You may have some luck overriding this default with WebSharperUseNetFxCompiler, see the documentation.

By on 1/6/2019 1:54 AM ()

Hello. How do I run Websharper without mono? I added the SqlProvider package via NuGet and I run it from a VS Code terminal with dotnet run command and I get this error.

I set true in .fsproj and I get this error:

1

/usr/local/share/dotnet/sdk/2.1.302/FSharp/Microsoft.FSharp.Targets(263,9): error MSB6006: "wsfsc.exe" exited with code 8. [/Users/enkhdulguun/Documents/snapify_fsharp_api/snapify_fsharp_api.fsproj]

and if I remove true in .fsproj, I get this error:

1
2
3
4
5
6
7

FSC : parse warning FS3186: An error occurred while reading the F# metadata node at position 1 in table 'itycons' of assembly 'WebSharper.Core.JavaScript, Version=4.5.0.0, Culture=neutral, PublicKeyToken=dcd983dec8f76a71'. The node had no matching declaration. Please report this warning. You may need to recompile the F# assembly you are using. [/Users/enkhdulguun/Documents/snapify_fsharp_api/snapify_fsharp_api.fsproj]
FSC : parse warning FS3186: An error occurred while reading the F# metadata node at position 0 in table 'ivals' of assembly 'WebSharper.Core.JavaScript, Version=4.5.0.0, Culture=neutral, PublicKeyToken=dcd983dec8f76a71'. The node had no matching declaration. Please report this warning. You may need to recompile the F# assembly you are using. [/Users/enkhdulguun/Documents/snapify_fsharp_api/snapify_fsharp_api.fsproj]
\Users\enkhdulguun\Documents\snapify_fsharp_api\Site.fs(25,9,29,42): typecheck error FS3033: The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: Could not load file or assembly 'System.Data.SqlClient, Version=4.2.0.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621) [/Users/enkhdulguun/Documents/snapify_fsharp_api/snapify_fsharp_api.fsproj]
\Users\enkhdulguun\Documents\snapify_fsharp_api\Site.fs(25,9,29,42): typecheck error FS3033: The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: Could not load file or assembly 'System.Data.SqlClient, Version=4.2.0.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621) [/Users/enkhdulguun/Documents/snapify_fsharp_api/snapify_fsharp_api.fsproj]
\Users\enkhdulguun\Documents\snapify_fsharp_api\Site.fs(31,23,31,37): typecheck error FS0039: The field, constructor or member 'GetDataContext' is not defined. [/Users/enkhdulguun/Documents/snapify_fsharp_api/snapify_fsharp_api.fsproj]

The build failed. Please fix the build errors and run again.
By on 3/19/2019 2:27 AM ()

Hi Loïc, thanks for this. The compiler setting did the trick! You were right about the SQLProvider, I already had pre build and post build steps to put this in the right place and have it included as an assembly directly as well as a nuget reference.

By on 1/6/2019 7:41 AM ()