Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0 Sqlite App.config
Hi All,
 
i am working on one app in which i am using SQLite connectivity for my database.while connecting to my database it is giving me below error :-
 
"Message = "Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information."
 
I searched on web and found below two different solutions which i have added  in my code :
 
1. Added in  my app.config file :
 
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
 
2. Modified project property:
 
"generate serialization assembly = Off"
 
but after doing this still i am facing same issue. Please help me out..
 
Thanks
Posted 24-Apr-13 21:57pm
Comments
venu gopal reddy m at 27-Dec-13 17:53pm
   
Hi,

I am also having same problem with SQLite. Did you find why it is throwing the above exception? Please send me if you have found a way around.
RyanDev at 27-Dec-13 20:43pm
   
Try http://stackoverflow.com/questions/6425707/mixed-mode-assembly-is-built-against-version-v2-0-50727-of-the-runtime
Sergey Alexandrovich Kryukov at 27-Dec-13 21:04pm
   
Why using assembly built to v.2.0 of the framework at all? Can't you get or build it for v.4.0?
—SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Hi
 

You should replace SQLite DLL v2.0 with SQLite DLL ver 4.0 download SQLite ver 4.0 of these links:
 
SQLite ver 4.0 32 bit
SQLite ver 4.0 64 bit
 
for getting more information please look at SQLite Org.
 
and I suggest to you read my article maybe it can change your solution Wink | ;-)
Build Your Own Generic Data Access Layer: Part II[^]
 
Best Regards.
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi,
 
I found a way around this after 3-4 hours of googling. I have added the following 
<startup selegacyv2runtimeactivationpolicy="true">
  <supportedruntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client" />
</startup>
If this doesn't solve your problem then--> In the Project References Right Click on System.Data.SQLite--> Select Properties--> Check the Run-time Version --> If it is v2.0.50727 then we know the problem.
The Problem is:- you are having 2.0 Version of SQLite DLL.
Solution is:- You can delete the System.Data.SQLite from the Project references and then download the latest version of DLL's from the following link and add the reference of the latest version DLL reference then it will work.
 
http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki
  Permalink  
v6

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

  Print Answers RSS
0 OriginalGriff 250
1 George Jonsson 175
2 Jochen Arndt 150
3 Kornfeld Eliyahu Peter 149
4 PIEBALDconsult 110
0 OriginalGriff 6,080
1 DamithSL 4,648
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,624
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 28 Dec 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100