x86 and x64 System.Data.SQLite issue

与世无争的帅哥 提交于 2019-12-10 12:18:22

问题


I found a lot of questions about this problem but did not find any answers. I have a rather strange problem. When I add a 32bit reference for System.Data.SQLite to my project it only works on x86 platform, and that should be fine by me as my app will run only on 32bit Windows. But when I try to run the app on 32bit Windows it throws the exception Could not load file or assembly 'System.Data.SQLite'. Then I downloaded 64bit version of System.Data.SQLite dll. Then I could start debug with ANY CPU target platform, but couldn't run the app on my 32bit XP that had the same error Could not load file or assembly 'System.Data.SQLite'.

I'm going a bit crazy. I don't know it is of any relevance, I don't see any, but target framework for my app is .NET 4.0 and I tried every combination of System.Data.SQLite (.NET 2.0, .NET 3.5, .NET 4.0) 32bit and 64bit version, nothing helps. Here is how my config file looks like:

<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>

回答1:


I found solution. Actual I found where I made mistake :) i downloaded binaries that are no statically linked and it required visual c++ runtime. So solution for this is to install visual c++ runtime or download system.data.sqlite statically linked binaries :D



来源:https://stackoverflow.com/questions/8965880/x86-and-x64-system-data-sqlite-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!