无法在 DotNetNuke 中加载文件或程序集 EntityFramework

Could not load file or assembly EntityFramework in DotNetNuke

我在 DotNetNuke 中有一个旧模块。我在我的项目中使用了 EF 5:

我向 DotNetNuke 添加了模块并且它工作正常。但是当我向 EF 6 添加需要的新模块时,我的模块给我一个错误:

Could not load file or assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.

安装这个新模块时EntityFramework 6 dll 文件将被替换为旧版本 (Version=5.0.0.0) 文件,这会导致旧模块无法工作。

我阅读了很多 post 来解决这个问题,但我找不到解决这个问题的方法。

如果有人能解释这个问题的解决方案,那将非常有帮助。

您可以将此添加到 web.config

<configuration>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
                    <bindingRedirect oldVersion="0.0.0.0-6.1.3.0" newVersion="6.1.3.0" />
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
</configuration>

您可以将此添加到您的 web.config

<configuration>
  <runtime>
    <dependentAssembly>
      <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
      <codeBase version="6.0.0.0" href="bin/EntityFramework-6.1.3/EntityFramework.dll" />
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="EntityFramework.SqlServer" publicKeyToken="b77a5c561934e089" culture="neutral" />
      <codeBase version="6.0.0.0" href="bin/EntityFramework-6.1.3/EntityFramework.SqlServer.dll" />
    </dependentAssembly>
  </runtime>
</configuration>

您必须将名为 EntityFramework-6.1.3 的文件夹添加到 bin 文件夹中,然后向其中添加两个 follow dll 1-EntityFramework.dll 2-EntityFramework.SqlServer.dll