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
564 stars 144 forks source link

Error in simple SQLProvider project. 'dataContext' does not define the field Main. #820

Closed shin0kaze closed 2 months ago

shin0kaze commented 2 months ago

Describe the bug When I run simple project from documentation I got following error: Error FS0039 : The type 'dataContext' does not define the field, constructor or member 'Main'.

To Reproduce Steps to reproduce the behavior: Just launch this project.

Expected behavior No errors, on such simple project

Desktop (please complete the following information):

Additional context My project that contains this error https://github.com/shin0kaze/sqlError

I'm actually don't know if it's bug, or I doing something wrong. I'm new to f#.

Thorium commented 2 months ago

You are missing Microsoft.Data.Sqlite.dll from your files path. Copy the netstandard2.0 version of it to there. You can get it e.g. from C:\Users\(yourname)\.nuget\packages\microsoft.data.sqlite.core\8.0.4\lib\netstandard2.0 or whatever is your NuGet path.

Edit: After that you may need to re-open your editor (e.g. Visual Studio).

shin0kaze commented 2 months ago

Thanks for the suggestion. I added a new lib, and copied the existing ones again from netstandart2.0 as well for compatibility (pushed to the repo). But that didn't help. Maybe something is wrong with these dlls?

Thorium commented 2 months ago

Hmm, I took your original report, just added Microsoft.Data.Sqlite.dll to your files and it worked (VS2022).

shin0kaze commented 2 months ago

Switched to the previous commit and added the new lib. But still error persist. Then updated and repaired VS 2022, also didn't helped. Tried Rider - same result. I don't know, maybe I should reinstall the entire.net?

Tomorrow, I will also try to run it on another PC.

Thorium commented 2 months ago

Silly question but did you have the database file also in place?

shin0kaze commented 2 months ago

Oh, there was an empty file test.db)) I thought it would create the database in ReadWriteCreate mode if none existed. Thanks for helping!