EntityFramework 5 Install fails in VS 2012

entity-framework nuget visual-studio-2012

Question

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=5.0.0.0, 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!

::Edit::

I forgot to add I tried the following entry to the web.config file as well:

<assemblies>
    <add assembly="System.Data.Entity, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  </assemblies>

...which yielded the same error.

1
7
12/11/2012 5:43:28 PM

Accepted Answer

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.

2
12/11/2012 5:48:55 PM

Popular Answer

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.



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