Eun*_*eer 5 .net c# sqlite winforms entity-framework-6
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>
Run Code Online (Sandbox Code Playgroud)
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"
Run Code Online (Sandbox Code Playgroud)
我在这里找到了修复程序:SQL DDEX for EF6,因为我已将 VS 安装到新笔记本电脑中。
脚步:
安装最新的SQLCEToolbox(这是一个 .vsix 附加组件,能够在 VS IDE 中打开 SQLite DB)。按照安装程序提示进行操作,可能需要停止任务,您需要单击“结束任务”才能继续安装
在 GAC 中安装SQLite(注意:x86 而非 x64)每台计算机安装一次。下载最新的 sqlite-netFx46-setup-bundle-x86-2015-1.0.xxx.0.exe(来自https://system.data.sqlite.org/index.html/doc/trunk/www/downloads-unsup)。 wiki )
注意:对于 VS2022 - 使用 x64 安装包
选择所有复选框:“完全安装”,将程序集安装到全局程序集缓存中并安装 VS 设计器组件
重启VS
检查:在VS主菜单:工具中,有一个新条目SQLite/SQLServer紧凑工具箱。单击它,它将打开一个新选项卡,解决方案资源管理器位于它附近。单击关于(问号图标)并检查 GAC 和 DDEX 提供商是否为“是”
| 归档时间: |
|
| 查看次数: |
3965 次 |
| 最近记录: |