简体   繁体   English

: System.IO.FileLoadException: 无法加载文件或程序集“EntityFramework”

[英]: System.IO.FileLoadException: Could not load file or assembly 'EntityFramework'

System.IO.FileLoadException: Could not load file or assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. System.IO.FileLoadException: 无法加载文件或程序集“EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”或其依赖项之一。 The located assembly's manifest definition does not match the assembly reference.定位的程序集的清单定义与程序集引用不匹配。 (Exception from HRESULT: 0x80131040) (来自 HRESULT 的异常:0x80131040)

App.config应用配置

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
  </startup>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v13.0"/>
      </parameters>
    </defaultConnectionFactory>
  </entityFramework>
</configuration>

packages.config包.config

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="AutoMapper" version="9.0.0" targetFramework="net462" />
  <package id="EntityFramework" version="5.0.0" targetFramework="net462" />
</packages>       

I tried to uninstall and re install EF do all the Solution hear and i can't change target framework to 5 because i use automaper我尝试卸载并重新安装 EF 解决所有问题,但我无法将目标框架更改为 5,因为我使用了 automaper

Check a couple of things.检查几件事。

  • Make sure the version of EF installed supports the version of .Net you're using.确保安装的EF版本支持您使用的.Net版本。
  • uninstall and reinstall卸载并重新安装
  • Make sure Nuget installed EntityFramework package确保 Nuget 安装了 EntityFramework 包
  • Make sure that all the projects are targeting the same .NET Framework.确保所有项目都针对相同的 .NET Framework。

EDIT:编辑:

Check your refrences for every EntityFramework.dll Go and check the version for each one.检查每个EntityFramework.dll然后检查每个的版本。

I have same problem, i just make sure that i am referencing the correct framework .Net in all the projects in web config我有同样的问题,我只是确保我在 web 配置中的所有项目中引用了正确的框架 .Net

i change this我改变这个

<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>

to

<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework" requirePermission="false"/>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 System.IO.FileLoadException:&#39;无法加载文件或程序集&#39;EntityFramework或其依赖项之一。 访问被拒绝。 - System.IO.FileLoadException: 'Could not load file or assembly 'EntityFramework or one of its dependencies. Access is denied.' System.IO.FileLoadException:无法加载文件或程序集 - System.IO.FileLoadException: Could not load file or assembly System.IO.FileLoadException:无法加载文件或程序集 'System.Runtime.CompilerServices.Unsafe,版本 = 4.0.4.1 - System.IO.FileLoadException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1 System.IO.FileLoadException:无法加载文件或程序集&#39;System.Data.SQLite - System.IO.FileLoadException: Could not load file or assembly 'System.Data.SQLite System.IO.FileLoadException - 无法加载文件或程序集 Microsoft.WindowsAzure.Storage - System.IO.FileLoadException - Could not load file or Assembly Microsoft.WindowsAzure.Storage System.IO.FileLoadException:无法加载文件或程序集“ Microsoft.AspNetCore.Mvc.Core,版本= 2.1.3.0” - System.IO.FileLoadException: Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Core, Version=2.1.3.0' Dockerized .NET 5 应用程序 - System.IO.FileLoadException:无法加载文件或程序集 - Dockerized .NET 5 Application - System.IO.FileLoadException: Could not load file or assembly 错误System.IO.FileLoadException:&#39;无法加载文件或程序集&#39;log4net,版本= 2.0.8.0在.NET Core中 - Error System.IO.FileLoadException: 'Could not load file or assembly 'log4net, Version=2.0.8.0 in .NET Core System.IO.FileLoadException:无法加载文件或程序集&#39;Pkcs11Interop,版本= 3.3.0.0 - System.IO.FileLoadException: Could not load file or assembly 'Pkcs11Interop, Version=3.3.0.0 System.IO.FileLoadException:无法加载文件或程序集Log4net - System.IO.FileLoadException: Could not load file or assembly Log4net
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM