I'm attempting to install the latest version of the EntityFramework from the Program Manager console in Visual Studio 2012. Running the install-package command yields the following error:
PM> install-package EntityFramework You are downloading EntityFramework from Microsoft, the license agreement to which is available at http://go.microsoft.com/fwlink/?LinkId=253898&clcid=0x409. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device. Successfully installed 'EntityFramework 5.0.0'. Successfully uninstalled 'EntityFramework 5.0.0'. Install failed. Rolling back... install-package : Failed to add reference to 'System.Data.Entity'. Please make sure that it is in the Global Assembly Cache. At line:1 char:1 + install-package EntityFramework + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
So I did some poking around on Google and came up with the following to enter in the Web.Config file. I made a second attempt at installing the EntityFramwork with the following entry:
<section name="entityFramework" type="EntityFramework.dll, EntityFramework, Version=22.214.171.124, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
Which resulted in the same error. My questions are these:
How can I get this package installed? Out of the box this should work and does with other packages this seems silly that this package can't be installed quickly and easily.
Where does the documentation for this package along with some form of a FAQ exist? This too seems silly that documentation for installation issues does not exist.
Thanks in advance!
I forgot to add I tried the following entry to the web.config file as well:
<assemblies> <add assembly="System.Data.Entity, Version=126.96.36.199, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> </assemblies>
...which yielded the same error.
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
this will do all the things automatically for you.
This error was, for us, caused by targeting the wrong version of .NET - we'd accidentally created our project targeting .NET 2. Changing the target framework version to .NET 4 fixed the problem and allowed us to add the NuGet package for Entity Framework.