System.Data.SQLite.DLL不再加载后切换目标框架 [英] System.Data.SQLite.DLL no longer loads after switching target framework

查看:288
本文介绍了System.Data.SQLite.DLL不再加载后切换目标框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不得不从.NET 4.5切换到.NET 4.0,因为我的一些客户仍然使用的WinXP。现在,切换后,这是我收到的错误:

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:

  1. 切换回4.5 - 没有工作
  2. 再次添加引用 - 没有工作

任何人都知道一个解决方案吗?

Anyone know a solution?

推荐答案

正确的方法来解决这个问题是从的 http://system.data.sqlite.org

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.

您使用的是旧System.Data.SQLite组件是面向.NET 2.0的混合code组装。在.NET 4的默认政策是不会允许这样的组件来加载,但你可以明确地允许它的过程中加入这样的事情到MyApp.exe.config文件:

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.

这个计算器的问题覆盖类的理由:

这篇关于System.Data.SQLite.DLL不再加载后切换目标框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆