fsprojects / SQLProvider

A general F# SQL database erasing type provider, supporting LINQ queries, schema exploration, individuals, CRUD operations and much more besides.
https://fsprojects.github.io/SQLProvider
Other
572 stars 146 forks source link

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

Closed Arrow7000 closed 9 months ago

Arrow7000 commented 5 years ago

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 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 commented 5 years ago

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 commented 5 years ago

@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 commented 5 years ago

For this project to build, you have to first restore packages by e.g. running build.cmd

On Tue, 14 May 2019, 18:02 Aron Adler, notifications@github.com wrote:

@Thorium https://github.com/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: image] https://user-images.githubusercontent.com/13225609/57717001-232cd200-7672-11e9-9dd2-43f98b109515.png

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.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/fsprojects/SQLProvider/issues/617?email_source=notifications&email_token=AABX726AXYCGJLCUYV43JCDPVLWAZA5CNFSM4HMUGZL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVMEDVA#issuecomment-492323284, or mute the thread https://github.com/notifications/unsubscribe-auth/AABX72ZDIVHTGBB623OSWTTPVLWAZANCNFSM4HMUGZLQ .

Thorium commented 5 years ago

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

Arrow7000 commented 5 years ago

@Thorium I just tried adding the resolution path. See this commit https://github.com/Arrow7000/SqlProviderTest/commit/441e62a00dcc767a1434db01028f984b45f7f996

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 commented 9 months ago

Should be fixed already