【问题标题】:Could not load file or assembly EntityFramework in DotNetNuke无法在 DotNetNuke 中加载文件或程序集 EntityFramework
【发布时间】:2016-12-10 08:17:49
【问题描述】:

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

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

无法加载文件或程序集 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' 或其之一 依赖关系。定位程序集的清单定义不 匹配程序集引用。

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

我阅读了很多解决此问题的帖子,但我找不到解决此问题的方法。

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

【问题讨论】:

    标签: entity-framework dotnetnuke dotnetnuke-module


    【解决方案1】:

    您可以将其添加到您的 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>
    

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

    【讨论】:

      【解决方案2】:

      您可以将其添加到 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>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-05-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-12-18
        • 1970-01-01
        • 1970-01-01
        • 2014-11-10
        相关资源
        最近更新 更多