2012-01-22 56 views
0

我发现了很多关于此问题的问题,但没有找到任何答案。我有一个相当奇怪的问题。当我为我的项目添加一个32位的System.Data.SQLite参考时,它只能在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'的应用程序。x86和x64 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> 

回答

2

我找到了解决方案。实际上,我发现我犯的错误:)我下载了没有静态链接的二进制文件,它需要visual C++运行库。因此,解决方案是安装visual C++运行时或下载system.data.sqlite静态链接的二进制文件:D

+0

非常感谢发布此内容,对我而言,它是缺少的一块! – Rob