ErikEJ / SqlCeToolbox

SQLite & SQL Server Compact Toolbox extension for Visual Studio, SSMS (and stand alone)
Other
843 stars 175 forks source link

Unable to find requested .Net Framework Data Provider in Visual Studio 2022 #924

Closed AhmedShamel closed 2 years ago

AhmedShamel commented 2 years ago

First I want to think Mr. Erik for his wonderful extension. I am using SQLite and SQL Server Compact Toolbox for the past two years.

However, I bought new laptop and install latest visual studio (VS2022), latest SQLite and SQL Server Compact Toolbox (version 4.8.735.0), and install sqlite-netFx46-setup-bundle-x86-2015-1.0.115.5, but unfortunately get (SQLite EF6 DbProvider in GAC - No).

bg1

I read the instruction in this link https://github.com/ErikEJ/SqlCeToolbox/wiki/EF6-workflow-with-SQLite-DDEX-provider, so I checked the machine.config file and it seems to be correct bg2

Also l checked the app.config, also it seems to be correct bg2

I tried to add the database to the project, and as expected I get the error (Unable to find requested .Net Framework Data Provider)

bg3

ErikEJ commented 2 years ago

Maybe because VS 2022 is 64 bit?

AhmedShamel commented 2 years ago

Thanks for your replay. What can I do please?

AeroClassics commented 2 years ago

EricEJ I cannot seem to get any of this to work with VS2017 or VS2019. I have modified my machine.config to match you example. My app.config matches your example. I have added the System.Data.SQLite package from NuGet (I do not get a packages.config file which seems odd). Every time I try to create an ADO provider I never see SQLite as an option. My SQLite/SQL Server Compavt Toolbox looks like this: Version 4.8.735.0 - 1.947.722 downloads

SQL Server Compact 4.0 in GAC - Yes - 4.0.8876.1 SQL Server Compact 4.0 DbProvider - No SQL Server Compact 4.0 Simple DDEX provider - Yes

SQL Server Compact 3.5 in GAC - No SQL Server Compact 3.5 DbProvider - No

Sync Framework 2.1 SqlCe 3.5 provider - No

SQLite ADO.NET Provider used: 3.31.1 SQLite EF6 DbProvider in GAC - Yes System.Data.SQLite DDEX provider - No SQLite Simple DDEX provider - Yes

I am dropping a zip in case you would like to see what the solution looks like. There is noting in it as I was just trying to get a SQLite provider added.

Any thoughts or help would be greatly appreciated.

Thanks! Doug EB200Reader.zip

ErikEJ commented 2 years ago

Have you double checked against the guide, ensuring exact same versions are used everywhere?

AeroClassics commented 2 years ago

Which Guide? Your EF6 workflow guide? If that is what you refer to, then yes, I have followed it explicitly. If it is another guide then I am not sure if I have double checked or not.

ErikEJ commented 2 years ago

@AeroClassics yes, that guide

ErikEJ commented 2 years ago

@AeroClassics and you followed the exact install instructions?

AeroClassics commented 2 years ago

Yes, multiple times. Life was easy under VS2015! I have gone so far as to be sure I removed everything using Programs and Features, plus going into the GAC and making sure everything was out of there. Hoping that I scrubbed the system enough. I have only installed what is called for in you workflow. I have not installed SQLite, by using something like the "Precompile Binaries for Windows Runtime" from https://www.sqlite.org/download.html. Not sure if that is needed or not.

AeroClassics commented 2 years ago

As a side note. I can connect to a SQLite database using the toolbox. It is just getting an ADO provider created that is the problem.

ErikEJ commented 2 years ago

@AhmedShamel I am unable to make this work in VS 2022, not surprising since the SQLite VS integration was not updated since 2015. I am able to use the "Simple SQLite" provider in VS 2019.

ErikEJ commented 2 years ago

@AeroClassics I am able to use the "Simple SQLite" provider in VS 2019, not in VS 2022. You can test by adding a data connection in Server Explorer in VS.

AeroClassics commented 2 years ago

I am also able to do that. What I have done to overcome this problem was to copy the required DLLs and App.config file from a working application. This let me move forward. Why I cannot do this from scratch, I don't know. But at least I am moving forward again.

maforget commented 2 years ago

I was able to make it work with 2022, by installing the 64 bit version of the setup-bundle and manually modifying the machine.config in %windir%\Microsoft.NET\Framework64\v4.0.30319\Config the <system.data><DbProviderFactories> entry was empty. Once that done it detected in GAC and I was able to create a new Entity Model.

Maybe it's worth updating the Wiki with the info about 2022, that needs another package and a different path for the machine.config.

ErikEJ commented 2 years ago

@maforget that really great news.

Could you share a link to the page and the name of the package you installed?

And your machine.config changes?

ErikEJ commented 2 years ago

I have updated the guide for VS 2022 https://github.com/ErikEJ/SqlCeToolbox/wiki/EF6-workflow-with-SQLite-DDEX-provider

maforget commented 2 years ago

You already updated the wiki, so I guess you figured it out. But here I just installed this https://system.data.sqlite.org/downloads/1.0.115.5/sqlite-netFx46-setup-bundle-x64-2015-1.0.115.5.exe and just copy pasted the machine.config from the 32bit folder.

    <system.data>
        <DbProviderFactories><add name="SQLite Data Provider" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6, Version=1.0.115.5, Culture=neutral, PublicKeyToken=db937bc2d44ff139" /></DbProviderFactories>
    </system.data>
ErikEJ commented 2 years ago

@maforget Thanks! You gotta love those assembly version numbers...