The type 'System.Data.Entity.DbContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'EntityFramework 2

后端 未结 10 632
无人共我
无人共我 2021-02-02 05:37

I\'ve got one solution - the one project is class library with .edmx data model The other is asp.net web forms project.

when i start the solution I get the following e

相关标签:
10条回答
  • 2021-02-02 06:33

    I think your EntityFramework version was confused

    Please download the correct version by using the NuGet package installer.

    See this discussion for getting started: The type or namespace name 'DbContext' could not be found

    And look this same problem and Answer : is Here

    0 讨论(0)
  • 2021-02-02 06:35

    I found this solution suitable for me.

    Adding Entity Framework DLL Reference:-

    1. Go to c:\Program Files (x86)\Microsoft ASP.NET\ASP.NETMVC 4\Packages\EntityFramework 5.0.0-rc\lib\net45

    2. Add Entity framework DLL

    0 讨论(0)
  • I had the same problem and I finally solved it. what you should do is to uninstall every instance of entity framework on your pc. If you have installed it using the setup file you have to remove it from add/remove programs and if you have installed it using the nugget packages, you have to uninstall it from there.

    Then you install in again using the nugget packages and restart your visual studio. This solved my problem.

    0 讨论(0)
  • 2021-02-02 06:38

    Add the correct reference in *.csproj file. in my cas i have added below in *.csproj file and problem solved.

     <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
          <HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath>
          <Private>True</Private>
        </Reference>
        <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
          <HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath>
          <Private>True</Private>
        </Reference>
    
    0 讨论(0)
提交回复
热议问题