程序停止工作,问题事件名称:CLR20r3

时间:2011-08-31 21:24:40

标签: c# visual-studio-2010 sqlite

我从发布文件夹开始我的程序。在我的Windows 7 64位计算机上,它正在运行。

在虚拟机Windows 7 32位中它正在运行。

在使用Windows 7 64位的第三台计算机上,它无法正常工作。

在我安装了.NET Framework 4的每台机器上,我的项目都使用.NET Framework 3.5,因为我使用SQLite数据库,而SQLite dll,因为我理解需要将项目作为.NET Framework 3.5。

我正在使用Visual Studio 2010 Express版,SQLite数据库。

以下是来自第三台计算机的错误:

Description:
Stopped working

Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01:   geotest.exe
Problem Signature 02:   1.0.0.0
Problem Signature 03:   4e58f462
Problem Signature 04:   GeoTest
Problem Signature 05:   1.0.0.0
Problem Signature 06:   4e58f462
Problem Signature 07:   f
Problem Signature 08:   12
Problem Signature 09:   System.BadImageFormatException
OS Version: 6.1.7600.2.0.0.256.1
Locale ID:  1033

2 个答案:

答案 0 :(得分:8)

3.0版以后的公共语言运行时使用不同的方法加载混合模式程序集(其中一个包含托管的本机代码),如SQLite。由于SQLite是针对.NET Framework 2.0构建的,因此我们必须明确告诉CLR使用旧的2.0方式加载混合模式程序集:

在项目中添加(或更新)app.config:

<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
  </startup>
</configuration>

其他问题也会显示有关此问题的更多信息:SQLite-specific / generic explanation

答案 1 :(得分:1)

在release文件夹中没有System.Data.SQLite.DLL,这是个问题。现在当我复制它时,一切正常。