fsprojects/SQLProvider

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

shin0kaze opened this issue · 6 comments

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):

  • OS: Win10

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#.

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).

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?

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

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.

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

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