EntityFramework 5 Install fails in VS 2012

12,372

Solution 1

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.

Solution 2

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.

Solution 3

I had a similar error. After going back to .NET 4.0 from 4.5 EF was installed OK. (Visual Studio Express 2012 for Web)

Solution 4

I found that I just had to try adding it in NuGet again; it worked the second time. Maybe there is a bug in the installation script.

Share:
12,372
Techie Joe
Author by

Techie Joe

Updated on July 29, 2022

Comments

  • Techie Joe
    Techie Joe almost 2 years

    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.