【问题标题】:Does useLegacyV2RuntimeActivationPolicy work in class library projects?useLegacyV2RuntimeActivationPolicy 是否适用于类库项目?
【发布时间】:2013-01-29 05:20:01
【问题描述】:

我的项目设置如下所示:

我的应用程序 (4.0) --> 我的类库 (4.0) --> 3rd 方库 (2.0.50727)

我的应用程序的 app.config 如下所示:

<?xml version="1.0"?>
<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
</configuration>

但在尝试启动应用程序时,我收到了可怕的 FileLoadException:

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.

各自的第三方库是“System.Data.SQLite”v1.0.60.0。是否也需要为我的类库启用“useLegacyV2RuntimeActivationPolicy”属性?我该怎么做?

提前感谢您的帮助和问候

【问题讨论】:

  • this 有帮助吗?
  • 根据this线程,你不需要将它添加到超过应用程序的app.config中。
  • 类库没有自己的.config 文件——唯一重要的是主程序集的文件。
  • @Default 不,对不起...

标签: c# sqlite mixed-mode fileloadexception


【解决方案1】:

现在想通了。我没有复制生成的 .exe.config 文件和我的 .exe -.- ...完全是我的错,对此感到抱歉。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-10
    • 2020-12-20
    • 1970-01-01
    • 2018-02-20
    • 2012-10-14
    相关资源
    最近更新 更多