Steven
Steven

Reputation: 18869

Could not locate assembly "EntityFramework"

I've been working on this MVC 3 application on my home computer for a while now. I'm out of town on a different computer, so I got the project from my source control. This new computer didn't have MVC 3 yet, so I installed it after I copied the project to the new computer.

A lot of my dlls (like MvcContrib.dll) were missing since I didn't set Copy Local to true when I first created the project on my home computer. So I've been going in and downloading all the missing dlls and adding them to my project.

The only one I can't find is EntityFramework.dll. I can't find a download for it, and I don't see it as a .NET dll when I try to add a reference.

enter image description here

I'm getting this warning when I try to build: Could not resolve this reference. Could not locate the assembly "EntityFramework"

Upvotes: 18

Views: 73600

Answers (6)

Boogiebart
Boogiebart

Reputation: 1

If EntityFramework was installed previously you can also manually add reference with browse. Select the following file in your project folder: \packages\EntityFramework.5.0.0\lib\net4x\EntityFramework.dll

Then add the following if missing in your packages.config:

<packages>
    <package id="EntityFramework" version="5.0.0" targetFramework="net4x" />
</packages>

Upvotes: 0

Mark
Mark

Reputation: 468

This can also happen when you manually remove the EntityFramework reference in a project.

If you've lost the reference you can remove the entry in packages.config for EntityFramework

<packages>
    <package id="EntityFramework" version="5.0.0" targetFramework="net40" />
</packages>

After removal you are able to re-install the package through the Package Manager (Manage NuGet Packages)

Upvotes: 18

bbach
bbach

Reputation: 96

If you have not - install the Nuget extension in Visual Studio.

Using Nuget will not only enable you to have the packages with the source (in the packages directory), but will also help you keep things up to date. External dependencies you rely on should ideally be included with your solution so situations like yours do not occur.

As The Evil Greebo noted, you will need to go here to obtain the Visual Studio tooling. While the Nuget package will provide the code level support, the tooling is in the installer. I use both, so if there is an update to the package, it will show up in the Nuget update notices.

Upvotes: 6

egbutter
egbutter

Reputation: 790

I resolved a similar problem myself by downloading the ASP.NET MVC Tools Update. Any chance you are just missing that on this other computer?

Upvotes: 2

The Evil Greebo
The Evil Greebo

Reputation: 7138

You need to download and install Entity Framework separately:

http://blogs.msdn.com/b/adonet/archive/2011/04/11/ef-4-1-released.aspx

Upvotes: 7

Kinexus
Kinexus

Reputation: 12904

Download and install Framework 4.0 and it's included.

http://www.microsoft.com/download/en/details.aspx?id=17851

Upvotes: 9

Related Questions