I had to switch from .net 4.5 to .net 4.0 because some of my customers still use WinXP. Now, after switching, this is the error I'm getting:
Could not load file or assembly 'System.Data.SQLite,
Version=1.0.66.0, Culturre-neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies.
An attempt was made to load a program with an incorrect format.
I haven't been able to find a solution for this, but here's what I tried so far:
Anyone know a solution?
The right way to fix this is to download an updated version of the SQLite library for your target framework from http://system.data.sqlite.org .
The older System.Data.SQLite assembly that you are using is a mixed code assembly that targets .NET 2.0. The default policy under .NET 4 is to not allow such assemblies to load, but you can explicitly allow it for a process by adding something like this into the MyApp.exe.config file:
<?xml version="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
</startup>
</configuration>
Note that the change can break other things though.
This StackOverflow question covers similar ground:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.