Error 4 The type 'System.Data.Entity.Dbcontext' is defined in an Assembly that is not referenced

Asked

Viewed 803 times

2

I have looked for several solutions to this error on the internet and unfortunately nothing helped me.

Can anyone help me on how to fix this mistake??

Error 4 The type 'System.Data.Entity.Dbcontext' is defined in an Assembly that is not referenced. You must add a Reference to Assembly 'Entityframework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

  • Within your project, in the part of References, the Entity Framework is there?

  • Yes, in the library class where the file . edmx

  • Class Library? You separated the project into a DLL of Models and another presentation? And the presentation layer has this reference also?

  • The project is not MVC friend, is Webforms and is divided into layers. Answering your question, yes, but has more than two CL (layers).

  • Now it’s clearer to me. Each layer that makes use of a context needs to have the package installed. This has been done?

  • Tiago, I already did this procedure and the Gypsy tmb already suggested it in the low response. Gypsy, I have other projects structured in the same way and this happened only when I updated the Entity to 6.1.1

  • Which DLL should I reference in the other projects for Entity 6 Entityframework.dll or System.Data.Entity.dll ??

Show 2 more comments

2 answers

1

Open your Package Manager Console (from the Visual Studio menu: View > Other Windows > Package Manager Console) and type the command:

Update-Package -reinstall Entityframework

  • Nothing friend, I already uninstalled and reinstalled the Entity and the problem continues. But still thank you.

0

In your project:

  1. Right click on References > Add Reference ...
  2. Choose the tab Browse click on the same name button Browse
  3. Search the Folder of your project > packages > EntityFramework.X.XX. > lib
  4. Choosing EntityFramework.dll
  5. Clicking OK

Note: Maybe in the lib folder you have folders referring to the Dotnet version (Choose the one appropriate for your project) and then the DLL EntityFramework.dll.

Source: https://stackoverflow.com/questions/10950638/the-referenced-component-entityframework-could-not-be-found/12488405#12488405

Browser other questions tagged

You are not signed in. Login or sign up in order to post.