Skip to content
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

Having trouble referencing .NET Standard class library using SQLProvider from .NET Core project #617

Closed
Arrow7000 opened this issue May 13, 2019 · 6 comments

Comments

@Arrow7000
Copy link

Arrow7000 commented May 13, 2019

Reproduction of problem here: https://github.com/Arrow7000/SqlProviderTest


I'm fairly new to the .NET world so am having trouble wrapping my head around exactly what the problem is.

I've tried to use the SQL type provider directly in an F# .NET Core project, but had a bunch of problems getting it to work. From what I can tell that's due to incompatibilities between .net core and type providers.

So what I am trying instead is to have the SQL type provider code encapsulated in a .NET Standard project that I can reference from my main Core project.

I've managed to reproduce the problem in a minimal GitHub repo located here which demonstrates both that

  • the type provider is working in Visual Studio 2019 with IntelliSense, but
  • despite this I still get a build error when I try to start the Main project

The build error is:

Unable to find the file 'C:\projects\SqlProviderTest\SQLStuff\bin\Debug\netstandard2.0\SQLStuff.dll' in any of
 C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.netcore.app\2.2.0\ref\netcoreapp2.2
 C:\projects\SqlProviderTest\Main
 C:\Users\Aron\.nuget\packages\fsharp.core\4.6.2\lib\netstandard1.6

Why isn't the project reference simply working as expected? I've tried adding <Private>True</Private> to the project reference but that didn't make any difference

I know there are a bunch of similar issues in this repo but none of the solutions have worked for me.

I originally posted this on StackOverflow but someone there told me this repo might be a better place to ask the question.


P.S. in case it matters, I'm developing on Windows but the app gets deployed on a Docker container.

@Thorium
Copy link
Member

Thorium commented May 14, 2019

I would expect you need not only MySqlConnector.dll but also its dependencies:
System.Buffers.dll,
System.Threading.Tasks.Extensions.dll,
System.Runtime.InteropServices.RuntimeInformation.dll,
System.Data.Common.dll

See the example:
https://github.com/fsprojects/SQLProvider/tree/master/tests/SqlProvider.Core.Tests/MySql

If you clone this repo, does the example code work for you?

@Arrow7000
Copy link
Author

@Thorium I've now added those packages both as project dependencies and also directly as DLLs in this branch https://github.com/Arrow7000/SqlProviderTest/tree/add-deps. It still fails with the same error.

I have cloned the repo and it doesn't work. When I try to run dotnet build it fails with this error

image

When I try to run it in Visual Studio 2019 it fails because it can't find F# in the path - I think I have a newer F# version installed. But either way I don't want to hardcode my local F# path because that won't work when I deploy and build the code in a Docker container.

@Thorium
Copy link
Member

Thorium commented May 14, 2019 via email

@Thorium
Copy link
Member

Thorium commented May 14, 2019

I tried to clone your repo. You need to have the ResolutionPath to pointing a folder where these dlls are.

@Arrow7000
Copy link
Author

Arrow7000 commented May 14, 2019

@Thorium I just tried adding the resolution path. See this commit Arrow7000/SqlProviderTest@441e62a

It's still giving the exact same error though 😕

However the SQLStuff.dll not being found is not the cause, but the effect of some other error preventing the dll from being built in the first place. How do I find out what this original error is?

image

@Thorium
Copy link
Member

Thorium commented Nov 20, 2023

Should be fixed already

@Thorium Thorium closed this as completed Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants