C # Connection SQLite appears: mixed-mode assemblies are generated for the "v2.0.50727" version of the runtime and cannot be loaded in the 4.0 runtime without additional information being configured. Solutions for

Source: Internet
Author: User
Tags mixed sqlite database

C # connection SQLite appears:

Mixed-mode assemblies are generated for the "v2.0.50727" version of the runtime and cannot be loaded in the 4.0 runtime without additional information being configured. Solutions for

C # Connect SQLite database code:

1 usingSystem;2 usingSystem.Collections.Generic;3 usingSystem.ComponentModel;4 usingSystem.Data;5 usingSystem.Data.SQLite;6 usingSystem.Drawing;7 usingSystem.Linq;8 usingSystem.Text;9 usingSystem.Threading.Tasks;Ten usingSystem.Windows.Forms; One  A namespaceT_w_sqlite - { -      Public Partial classForm1:form the     { -          Public Staticsqliteconnection sqlconn; -          Public Static stringConnectionString ="Data source=e://test.db3; Pooling=true; Failifmissing=true";//Store A common database connection string -  +          Public StaticString startsqlconn () -         { +Sqlconn =Newsqliteconnection (ConnectionString); A             Try at             { - Sqlconn.open (); -             } -             Catch -             { -Sqlconn =NULL; in             } -             return "You Test success!"; to         } +          PublicForm1 () -         { the InitializeComponent ();
 *             Lable.text = startsqlconn ();  $ Panax Notoginseng         }    

Workaround:

Solution find the app. Config file

  

Under the configuration node of App. Config, add:

The original is:

1 <?xml version="1.0" encoding="utf-8" ?>  2 <configuration>3     4         <supportedruntime version="v4.0  " sku=". netframework,version=v4.5" />5     </startup>6 </ Configuration>

Modified to:

1<?xml version="1.0"encoding="Utf-8"?>2<configuration>3<startup uselegacyv2runtimeactivationpolicy="true">4<supportedruntime version="v4.0"sku=". netframework,version=v4.5"/>5</startup>6</configuration>

Can solve the above problems.

by Hruinger.

C # Connection SQLite appears: mixed-mode assemblies are generated for the "v2.0.50727" version of the runtime and cannot be loaded in the 4.0 runtime without additional information being configured. Solutions for

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.