Page 1 of 1

Need help with Deployment for C# project using SQlight in Visual Studio 2017

Posted: Fri 07 Dec 2018 03:32
by orbitcoms
I have created a small test program in VS 2017 that simply populates a listbox from SQLite db and allows adding new items to the list. It works fine on the development machine but when I create an installer and then install on another machine, the program runs but when I attempt to get data from the database I get this error “unable to find requested .Net Framework Data Provider”.

I have made sure the db is in c:\db on the target machine. Both machines are Windows 10.

Thanks in advance.

The app.config contentrs are as below.
<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=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
<connectionStrings>
<add name="mainEntities" connectionString="metadata=res://*/db.csdl|res://*/db.ssdl|res://*/db.msl;provider=Devart.Data.SQLite;provider connection string=&quot;Data Source=C:\db\Tempsaver2.db3&quot;" providerName="System.Data.EntityClient"/>
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/>
</entityFramework>
</configuration>

Re: Need help with Deployment for C# project using SQlight in Visual Studio 2017

Posted: Fri 07 Dec 2018 17:40
by Shalex
You should add the DbProviderFactories and entityFramework entries:

Code: Select all

<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=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
  </startup>
  <connectionStrings>
    <add name="mainEntities" connectionString="metadata=res://*/db.csdl|res://*/db.ssdl|res://*/db.msl;provider=Devart.Data.SQLite;provider connection string=&quot;Data Source=C:\db\Tempsaver2.db3&quot;" providerName="System.Data.EntityClient"/>
  </connectionStrings>
  <system.data>
    <DbProviderFactories>
      <remove invariant="Devart.Data.SQLite" />
      <add name="dotConnect for SQLite" invariant="Devart.Data.SQLite" description="Devart dotConnect for SQLite" type="Devart.Data.SQLite.SQLiteProviderFactory, Devart.Data.SQLite, Version=5.11.1278.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
    </DbProviderFactories>
  </system.data>
  <entityFramework>
    <providers>
      <provider invariantName="Devart.Data.SQLite" type="Devart.Data.SQLite.Entity.SQLiteEntityProviderServices, Devart.Data.SQLite.Entity.EF6, Version=5.11.1278.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
    </providers>
  </entityFramework>
</configuration>
For more information, refer to https://www.devart.com/dotconnect/sqlite/docs/?EF.html.