5

So I've been struggling to try and get this resolved for a week or so now. When I attempt to run my application on another computer other than my development machine, I get the following error:

Schema specified is not valid. Errors: EntityFramework.RemManagerDBModel.ssdl(2,79): error 0175: The ADO.Net provider with invariant name 'System.Data.SQLite.EF6' is either not registered in the machine or application config file, or could not be loaded. See the inner exception for details.

I attempted to retrieve the inner exception using this method, but to no avail. I'm not sure why it seems to think there is an inner exception, when in fact there isn't?

With regard to attempting to fix the issue myself, I have tried (I believe) all of the relevant possible solutions that are found under this SO question.

Currently my app.config looks something along the lines of what is shown below. An example of the connection string that is created is also included. The application uses Entity Framework 6 from a database first configuration. The entity model and diagram have been newly generated from the database file. I am able to open the entity diagram with no problems and regenerating it via the "run custom tool" option hasn't made any difference. The issue only seems to be present if I try to run the installed application on another computer. In this case, the computer is a totally clean (factory restored) version of Windows 10.

If any more information is required, I can add it in as necessary.

App.config file:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <section name="RemManager.Forms.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
    </sectionGroup>
  </configSections>
  <connectionStrings>
    <!-- See Datasource.ConnectionController for the connection string builder.-->
  </connectionStrings>
  <entityFramework>
    <providers>
      <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6, Version=1.0.106.0, Culture=neutral" />
      <provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6, Version=1.0.106.0, Culture=neutral" />
    </providers>
  </entityFramework>
  <system.web>
    <membership defaultProvider="ClientAuthenticationMembershipProvider">
      <providers>
        <add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
      </providers>
    </membership>
    <roleManager defaultProvider="ClientRoleProvider" enabled="true">
      <providers>
        <add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
      </providers>
    </roleManager>
  </system.web>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite.EF6" />
      <add name="SQLite Data Provider"
           invariant="System.Data.SQLite"
           description="Data Provider for SQLite"
           type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
      <add name="SQLite Data Provider (Entity Framework 6)"
           invariant="System.Data.SQLite.EF6"
           description=".NET Framework Data Provider for SQLite (Entity Framework 6)"
           type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
    </DbProviderFactories>
  </system.data>
</configuration>

Example Connection String:

metadata=res://*/EntityFramework.RemManagerDBModel.csdl|res://*/EntityFramework.RemManagerDBModel.ssdl|res://*/EntityFramework.RemManagerDBModel.msl;provider=System.Data.SQLite.EF6;provider connection string="data source=C:\Users\MacbookPro\AppData\Roaming\RemManager\Datasource\RemManagerDB.db;default timeout=5000;failifmissing=True;read only=False;version=3"
Eunoseer
  • 95
  • 3
  • 10
  • System.Data.SQLite isn't in the GAC in the other machine. Find the reference in your project and make CopyLocal = true and see if that works. – Daniel Lorenz Feb 05 '18 at 22:17
  • @DanielLorenz Unfortunately both of these references are already CopyLocal=True. I assume that I only have to do this on the references inside the main project? There is no need to make any changes for these in the installer project? There are all of the relevant SQLite and SQLite.EF6 DLL's in the installation directory of the application too for what it is worth. – Eunoseer Feb 05 '18 at 22:44
  • Maybe this can help: https://github.com/ErikEJ/SqlCeToolbox/wiki/EF6-workflow-with-SQLite-DDEX-provider ? – ErikEJ Feb 06 '18 at 13:19
  • 1
    @DanielLorenz The article looked promising. I have given it a go, but still no luck. I might try creating a separate project and try building just the data layer afresh, see if that reveals anything. If that doesn't work out I might make the test code public and link it here so people might be able to experiment themselves if they want. – Eunoseer Feb 07 '18 at 21:09
  • Well, it's been a while, but this issue is still unresolved. I've updated to the latest versions of sqlite and entity framework and it didn't seem to make much of a difference. I've never gotten around to that test project, however I do have another project coming up that will use similar functionality and I will report back if it faces the same problems. – Eunoseer Aug 15 '18 at 23:47
  • @Eunoseer Check this solution out https://stackoverflow.com/questions/9725979/unable-to-find-the-requested-net-framework-data-provider-sqlite – Ihab Sep 25 '19 at 04:57

1 Answers1

1

I found the fix here: SQL DDEX for EF6 as I had installed VS into a new laptop.

steps:

  • Install latest SQLCEToolbox (this is a .vsix add-on to be able to open SQLite DB within VS IDE). Follow the installer prompts, it may need to stop tasks you need to click "End Task" to continue the install

  • Install SQLite in GAC (note: x86 not x64) Once per machine. Download the latest sqlite-netFx46-setup-bundle-x86-2015-1.0.xxx.0.exe (from https://system.data.sqlite.org/index.html/doc/trunk/www/downloads-unsup.wiki)

    Note: for VS2022 - use the x64 setup bundle

  • Select all checkbox: "Full Installation", Install the assemblies into the global assembly cache and Install VS designer components

  • Restart VS

to check: in VS main menu: Tools, there is a new entry SQLite/SQLServer compact toolbox. Click on that and it will open a new tab where Solution Explorer is located near it. Click the About (question mark icon) and check both GAC and DDEX provider are "Yes"

k3nn
  • 131
  • 1
  • 6
  • I'll give it a go later. I'll have to spin everything else up because I mothballed the project. Also does this work if I don't have VS installed? The idea is that I shouldn't need to install VS on a machine in order to use the released version of my tool? – Eunoseer Jan 26 '22 at 04:29
  • well I guess, just go for the 2nd item and skip the 1st step because the 1st one is for VS and the 2nd one is for the windows machine GAC. But do note the GAC installer to be unchecked in "Install VS designer components" as you won't need it. I think I missed the part where you said you're deploying to another non-dev machine, so yes, do skip the 1st step. I was installing on another dev machine I use. – k3nn Jan 27 '22 at 08:14