Click here to Skip to main content
15,881,139 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hey Guys, I have a really confusing problem which I can't get to the bottom of.
I have developed a windows forms application which when I run locally i.e through visual studio it runs perfectly without any issues but when I deploy it to the end user's machine I get the below error.

System.BadImageFormatException: Could not load file or assembly 'System.Data.SQLite, Version=1.0.66.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: 'System.Data.SQLite, Version=1.0.66.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139'

I can't seem to figure out why I get this error or how to resolve it.

The end user machine is x64 bit also and I have set copy local to True in the properties of the dll.

Any help is very much apreciated.

Thanks
Posted
Updated 4-May-17 0:23am
Comments
Prasad Khandekar 8-Oct-13 11:16am    
Please use 64 bit dll version of SQLite dll (http://system.data.sqlite.org/downloads/1.0.88.0/sqlite-netFx45-setup-bundle-x64-2012-1.0.88.0.exe) elase change the deployment target to x86 architecture.

Regards,
Member 13094067 4-May-17 6:26am    
Could not load file or assembly 'System.Data.SQLite, Version=1.0.66.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: 'System.Data.SQLite, Version=1.0.66.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139'
Member 13094067 4-May-17 6:27am    
please help me how to fix this error???

1 solution

Maybe this support link[^] might help?

I've run into this before, if your main application is set to target AnyCPU and you have a DLL that is targeted as x86 or x64 it may give the exception because its loading in a different processor target than the DLL even though it runs fine on the development computer.

Also make sure that the target computer has the correct version of .NET on it.
 
Share this answer
 
Comments
Prasad Khandekar 8-Oct-13 11:22am    
My 5+
frostcox 8-Oct-13 13:14pm    
Thank you sir...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900