-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could not load file or assembly System.Data.SqlClient
if building using dotnet build
#373
Comments
I recently had this problem with SQLProvider (fsprojects/SQLProvider#645), and relying on MSBuild and the |
I am in the same situation as aggieben, I can get the typeprovider to work using the fix mentioned but it is not ideal. So it sadly does not just work “out of the box” I am afraid. |
For anyone wondering how to make this work, I put together an example project here: https://github.com/MarneeDear/FSharp.Data.SqlClient-dotnet This includes an |
I have to try this! |
https://github.com/demetrixbio/FSharp.Data.Npgsql is very similar to FSharp.Data.SqlClient. We recently migrated to netstandard2.0 without any net461 dependencies. It works smoothly on Windows/Unix using 3.1.201 SDK. If you are having issues, I would suggest to try new SDK. |
Related: #380 and dotnet/fsharp#10323 Thanks @MarneeDear for the workaround and putting up the repository. I'm not clear yet how to address this in the type provider or if this is an upstream problem with dotnet sdk version of F# compiler. |
I cannot get this to build with dotnet build at all now with latest version, 2.0.7, but it does build in VS 16.9.2. According to paket.lock:
Resulting in this error
Which is obviously very messed up. It's time to fix this properly with the new library I worked my way backwards to v2.0.2, which has a different problem
Same issue with v2.0.1 |
I was also experiencing this issue. I was able to build the project using Mono, rather than the native MacOS dotnet sdk. I configured this in Rider. Configured to build using the MSBuild.dll 15.0 from Mono succeeded:
But with MSBuild.dll 16.0 from the dotnet sdk the build fails:
As far as I can tell building with the Mono MSBuild.dll doesn't affect the |
We'd really like this to work too, and we'd rather not have to add Is there an update on if this looks fixable for |
Hello, where is this at? I tried to use SqlClient in rider.net with F# 6 and it gave me the same error reported in the OP. I tried the workaround suggested by someone else (to use fsc.props) but it didn't work. I also tried the same project in VS 2019 and it doesn't work. In the next few days I will try VS 2022, and I will be back to this thread. Thanks |
any updates on this? |
I am also interested in updates on this. I managed to get it working on macOS 12.4 (Apple Silicon) with .NET SDK 6.0.400. But I would rather not have to provide any workarounds.
This workaround prevents the 'ref' assembly from being provided to the compiler, and then manually adds the 'runtimes/unix/lib' assembly. |
@jackfoxy, @omcnoe, @costa100, @keppelerj, @cr3wdayt5p I am sorry I can't really help with the issue. Please see the issue I opened dotnet/fsharp#10323 related to discrepancy between VS shipped compiler and the one in dotnet SDK, maybe report other reproduce cases that would help the compiler team to iron out a solution to this issue. Thanks to everyone for providing more technical insights about workarounds for the different platforms. |
Description
When building a
netcoreapp3.1
ornetstandard2.1
library, the build will succeed when using Visual Studio 2019 but will fail when built viadotnet build
.Error details:
Repro steps
Create a dotnet core library which uses the type provider.
Expected behavior
I'd expect the non-reference version of
System.Data.SqlClient
to be loaded and the build to succeed.Actual behavior
The type provider is unable to load the
System.Data.SqlClient
assembly as it is a reference assembly.Known workarounds
Forcing the project to use the full framework compiler seems to work, but you need to set some properties for this to work in .netcore3.0
Related information
I found a number of what appear to be related but older issues. As far as i can tell .NET Standard 2.0 type providers can now be used when the F# compiler is running on .NET Core. So I believe this is an issue with loading the correct
System.Data.SqlClient
assembly?Environment
The text was updated successfully, but these errors were encountered: