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 1687
南方客
南方客 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: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

提交回复
热议问题