fsprojects / FSharp.Data.SqlClient

A set of F# Type Providers for statically typed access to MS SQL database
http://fsprojects.github.io/FSharp.Data.SqlClient/
Other
204 stars 71 forks source link

Can't build/run from the commandline, but can from Visual Studio 2019 #408

Closed Eji1700 closed 3 years ago

Eji1700 commented 3 years ago

Issue Summary

In certain scenarios, attempting to build from the commandline with dotnet build gives this error-

The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: System.Data.SqlClient is not supported on this platform.

However, running the project in Visual Studio builds and runs fine, and then you can build from the command line again (until you modify the file at all).

To Reproduce

Using the visual studio ide, create a dotnet core F# console project. Net5.0 framework.

Add the System.Data.SqlClient library along with this one.

Make a valid program that has a connection to a database and click run (can literally just make the connection and leave the hello world stuff, you just need to make sure you have a connection).

Using the terminal, navigate to the project and run dotnet build, it should work.

Change ANYTHING in the code in visual studio. Just add a space to the end of a line. Save.

Using the terminal, dotnet build. Should fail with the above error.

Using visual studio run the code. Should build and run.

Using the terminal, dotnet build. Should build fine.

Vs code is hit or miss with this as well. Working one moment, but if you change the file at all it will fail.

Error

This is on a windows machine but the initial user who brought this error to my attention was on mac (and could not get it to work at all). In my test case i'm connecting to an Azure MS Sql database, i don't know what the other user was using but I don't believe it should matter given the nature of the error.

Expected behavior

Should build/run no matter how you're doing it?

jackfoxy commented 3 years ago

Related to this https://github.com/fsprojects/FSharp.Data.SqlClient/issues/380 But it is really all about this https://github.com/fsprojects/FSharp.Data.SqlClient/issues/374

Sadly this project is stuck on old .NET Framework. It's a non-trivial project to get it up to net5.0

Eji1700 commented 3 years ago

Ahh ok. At least i'm not going crazy. I'll close since this is a dupe then.