Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Entity framework EntityFramework 5安装在VS 2012中失败_Entity Framework_Visual Studio 2012_Nuget - Fatal编程技术网

Entity framework EntityFramework 5安装在VS 2012中失败

Entity framework EntityFramework 5安装在VS 2012中失败,entity-framework,visual-studio-2012,nuget,Entity Framework,Visual Studio 2012,Nuget,我正在尝试从Visual Studio 2012中的Program Manager控制台安装EntityFramework的最新版本。运行install package命令会产生以下错误: PM> install-package EntityFramework You are downloading EntityFramework from Microsoft, the license agreement to which is available at http://go.microso

我正在尝试从Visual Studio 2012中的Program Manager控制台安装EntityFramework的最新版本。运行install package命令会产生以下错误:

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
因此,我在Google上做了一些探索,并在Web.Config文件中输入了以下内容。我再次尝试使用以下条目安装EntityFramwork:

<section name="entityFramework" type="EntityFramework.dll, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />

这导致了同样的错误。我的问题是:

  • 如何安装此软件包?开箱即用这应该可以工作,并与其他软件包这似乎是愚蠢的,这个软件包不能快速和容易地安装

  • 该软件包的文档以及某种形式的常见问题解答在哪里?安装问题的文档不存在,这似乎也很愚蠢

提前谢谢

::编辑::

我忘了添加,我也尝试了在web.config文件中添加以下条目:

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


…产生了相同的错误。

删除您对
web.config
文件所做的所有输入。只需在解决方案中的
右键单击项目名称
,在左侧单击
管理Nuget软件包
,在右侧单击
联机
,然后在搜索框中放置实体框架。单击
Install


这将自动为您执行所有操作。

对于我们来说,此错误是由于针对错误版本的.NET而导致的-我们意外地创建了针对.NET 2的项目。将目标框架版本更改为.NET 4修复了该问题,并允许我们为Entity framework添加NuGet包。

我发现我只需再次尝试在NuGet中添加它;它第二次起作用了。可能安装脚本中有错误。

我也有类似的错误。从4.5返回到.NET 4.0后,EF安装正常。(Visual Studio Express 2012 for Web)

我到底发生了什么事!谢谢你,马丁!我不知道为什么会出现这样的问题,我也不知道你的解决方案是如何工作的!!但是谢谢你@如果这个答案不能解决您的问题,我建议您更改“已接受的答案”