Could not load file or assembly 'System.Data.SQLite' or one of its dependencies. An attempt was made to load a program with an incorrect format

前端 未结 3 1657
南方客
南方客 2021-01-12 05:08

I am trying to use 64-bit Sqlite on my Aspx project. When I run the project, I got the following error:

Could not load file

相关标签:
3条回答
  • 2021-01-12 05:26

    Nuget was the final solution for me, i was using x64 because i have windows 8.1 64 bit,However i should use x86. once install System.Data.SQLite enter image description here

    0 讨论(0)
  • 2021-01-12 05:44

    If you are using visual studio try installing through the package manager http://www.nuget.org/packages/system.data.sqlite. This may help out with the dependency tree issues.

    0 讨论(0)
  • 2021-01-12 05:51

    If you do not use NuGet or prefer to reference the sqlite assemblies your self, make sure you use the right platform version (x64 vs x86).

    To support both platform, you can reference the System.Data.SQLite.dll, and adds 2 separate folders for each platform to hold the SQLite.Interop.dl.

    Copy from official sqlite download site:

    • bin\System.Data.SQLite.dll (required, managed-only core assembly)
    • bin\x86\SQLite.Interop.dll (required, x86 native interop assembly)
    • bin\x64\SQLite.Interop.dll (required, x64 native interop assembly)

    With this setup, your app can run in both x64 and x86 platform. For more detail info, you can refer to sqlite download site here

    0 讨论(0)
提交回复
热议问题