Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't add a reference to EntityFramework in my unit test project

I have a new project happily using Entity Framework 5. After I added the edmx to the solution, it added a reference to EntityFramework version 5.

I created a unit test project, and I need to use something from the EntityFramework library. However, there is no reference to EntityFramework. When I go to Add Reference, I cannot find it anywhere in the list.

I've checked and my unit test is referencing .NET 4.5. Any idea why I can't add the reference?

like image 925
NibblyPig Avatar asked May 06 '13 15:05

NibblyPig


3 Answers

Remove all the entries you have made to the web.config file. Just Right Click on your project name in the solution, Click on Manage Nuget Packages On your left hand Click on Online and on the right hand just put Entity Framework in the search box. Click on Install

this will do all the things automatically for you.

Answer is taken from: EntityFramework 5 Install fails in VS 2012

like image 148
Dima Condur Avatar answered Nov 18 '22 19:11

Dima Condur


I had the same problem with a new application. I opened the Package Manager Console and used install-package EntityFramework, which installed version 6 without issue.

like image 21
Rethic Avatar answered Nov 18 '22 20:11

Rethic


Just Adding System.Data.Entity might not enough;

because by this you are trying to referencing something that has not been installed yet.

this issue can be resolved by installing EntityFramework.

So to do this :

  • Go to Solution Explorer
  • Right Click on Your Project Name
  • Select "Manage NuGet packages"

Install Entity Framework

  • Now Install the Entity Framework.

Nuget Application Manager

like image 3
alamin Avatar answered Nov 18 '22 20:11

alamin