Could not load file or assembly 'System.Data.Entity

前端 未结 5 1107
余生分开走
余生分开走 2020-12-03 10:51

I am working within a Solution (a jokes website). The Solution has 2 Projects:

  1. Model (C# Class Library)
  2. MVC 3 Empty Application

I am t

相关标签:
5条回答
  • 2020-12-03 11:35

    To resolve this error:

    • Go to references section in your project
    • Right click it and than go add library package reference.
    • search in online tab for entity framework
    • you will get a lot of installed packages if u have internet connection enabled
    • Select EF4 package, and finally, add it

    If you have any entity frame work installed and you are getting an error then click for add reference and in Browse tab go to below location:

    C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0
    

    Select to find System.Data.Entity.dll and then add it. This will resolve this issue.

    0 讨论(0)
  • 2020-12-03 11:36

    To use an external Entity Framework model (embed in a DLL for example) with ASP.NET MVC 3 you must :

    1. Add the following reference to your MVC project : System.Data.Entity (Version 4.0.0.0, Runtime v4.0.30319)
    2. Add the following line in your web.config

    ...

    < compilation debug="true" targetFramework="4.0">
    
      <assemblies>
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      </assemblies>
    </compilation>
    
    0 讨论(0)
  • 2020-12-03 11:38

    Make sure you have referenced the System.Data.Entity assembly in your project. Not only in the web.config assemblies section but also those assemblies being referenced. Also make sure that the System.Data.Entity, V4.0.0.0 is present in the GAC on the server you are running this application.

    0 讨论(0)
  • 2020-12-03 11:44

    another way to solve this is to add empty edmx file (Add -> Class -> Data -> ADO.NET Entity Data Model) and delete it afterwards. I am not sure what the Visual Studio Wizard does, but it`s a common problem at my machine and i always fix it like that.

    0 讨论(0)
  • 2020-12-03 11:47

    I was getting the same error, and it was because the MVC3 project used Entity Framework 4.1, and my domain model (in a class library project, same solution) grabbed 4.2 when I added the reference. I uninstalled EF from my Web project, then reinstalled, now both have 4.2 and are working fine. Currently working with the Apress title, Pro ASP.NET MVC Framework (Freeman).

    0 讨论(0)
提交回复
热议问题