I am writing an application which requires a database. I am using SQLite and it seemed to be going well but one day I got the 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.

I am not sure what I have done to cause this. I searched for this issue and found solutions in previous questions. I have added the lines:
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>

in my .config file, although the full text is:
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
<requiredRuntime version="v4.0.20506"/>
</startup>

Does the different required runtime affect this?

The other solution was to set copy local to true on the SQLite assembly but this did not help.

Can anyone offer any more advice?