On some computers, the application cannot load the sqlite dll file

I wrote an application using sqlite and it works fine on most systems. It is written in C #, and the only non-structural assembly is sqlite, which is included in System.Data.SQLite.dll.

I deploy it to all computers (copy the exe file, the database file and the System.Data.SQLite file). It works great for all of my PCs and most of the PCs I have tried.

But then I have reports that for some people raise the following exception:

Failed to load file or assembly 'System.Data.SQLite, Version = 1.0.65.0, Culture = neutral, PublicKeyToken = db937bc2d44ff139' or one of its dependencies. An attempt was made to download a program using the wrong format.

Now I have made sure that the dll file is in the same folder as the application exe file. This is the same DLL with the same version as in the above exception message.

I was very confused by this, so I created a new virtual machine, installed Windows 7 Professional on it and just copied the attached files, and it worked. Therefore, if it works on fresh windows, I can’t imagine what another computer might lose ...

Note. Two of the machines in which the project throws an exception also work with Windows 7 proffesional.

I would really appreciate any help on this, because I'm fresh from ideas ...

+6
c # sqlite deployment system.data.sqlite
source share
3 answers

There is a possibility: Is the difference between working and non-working machines 32-bit and 64-bit? Are you building for "Any processor" when you have to build only a bit external DLL?

+12
source share

It is possible that the machines that generate the exception use the 64-bit version of Windows and that your program uses the AnyCPU configuration. DLL System.Data.SQLite - a two-faced beast: the managed part and the native part. It may be that the exclusion rests with its own part.

See this question for more details.

+1
source share

Have you checked if the target system is 64-bit or 32-bit?

Perhaps one of your dependencies requires a 32-bit version of Windows. To solve the problem, you can specify the target platform in the properties of your C # project: select x86 instead of Any CPU.

+1
source share

All Articles