Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Manually adding a reference to Entity Framework

I am working on a project that revolves around EF. I have the core layers of my project separated into different projects.

Unfortunately I constantly get errors that are happening because I am missing a reference to EntityFramework.SqlServer.dll in my project.

Adding the .dll file to my build folder fixes this issue, but I want to solve it by a "using" statement in my code, however I cannot do that as I am missing a reference to Entity Framework in my project.

I was wondering how do I add one?

*PS If I serach for EntityFramework in the "Add reference" panel, I don't get EF as an option.

**I could always install it with NuGet, but wouldn't that be redundant, since I already have it installed?

like image 896
Kobek Avatar asked Nov 17 '16 09:11

Kobek


People also ask

How do I add references to Entity Framework?

You can install the EntityFramework package by right-clicking on the References folder of your project and selecting Manage NuGet Packages…


2 Answers

I had the same issue on a N-tier solution where the DAL uses EF.

I solved it by adding a reference to the EntityFramework.SqlServer.dll in the web project.

Go to references --> Add Reference --> in the dialog, choose COM and press browse. Then go to your project which is using EF and go to the projects bin folder where the EF references are stored. Select the EntityFramework.SqlServer.dll and add it.

Then right click on the newly added reference --> Properties --> Select Copy Local to trueenter image description here

like image 156
Marcus Höglund Avatar answered Sep 21 '22 06:09

Marcus Höglund


You can also use Nuget by right-click on your project -> Manage Nuget Packages, then search for "EntityFramework". Install the Entity Framework with Nuget from Microsoft.

It will add both EntityFramework and EntityFramework.SqlServer packages.

like image 31
Alexandre Avatar answered Sep 20 '22 06:09

Alexandre