我发现了很多关于这个问题的问题,但没有找到任何答案。我有一个相当奇怪的问题。当我为我的项目添加System.Data.SQLite
的32位参考时,它只适用于x86平台,我应该没问题,因为我的应用程序只能在32位Windows上运行。但是当我尝试在32位Windows上运行应用程序时,它会抛出异常Could not load file or assembly 'System.Data.SQLite'
。然后我下载了64位版本的System.Data.SQLite dll
。然后我可以使用任何CPU目标平台开始调试,但无法在我的32位XP上运行具有相同错误Could not load file or assembly 'System.Data.SQLite'
的应用程序。
我有点疯狂。我不知道它有任何相关性,我没有看到任何,但我的应用程序的目标框架是.NET 4.0,我尝试了System.Data.SQLite
的每个组合(.NET 2.0,.NET 3.5,.NET) 4.0)32位和64位版本,没有任何帮助。以下是我的配置文件的样子:
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite"/>
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite"/>
</DbProviderFactories>
</system.data>
<connectionStrings>
<add name="VetStationConnection" connectionString="Data Source=VeterinaryStation.s3db" providerName="System.Data.SQLite.SQLiteFactory"/>
</connectionStrings>
答案 0 :(得分:2)
我找到了解决方案。实际我发现我犯了错误:)我下载了没有静态链接的二进制文件,它需要visual c ++运行时。因此,解决方案是安装visual c ++运行时或下载system.data.sqlite静态链接的二进制文件:D