2012-01-22 55 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