Manually adding a reference to Entity Framework

c# entity-framework nuget reference visual-studio

Question

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?

1
5
10/25/2017 12:26:30 AM

Accepted Answer

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

5
11/17/2016 12:14:48 PM

Popular Answer

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.



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow