安装实体框架在Visual Studio 2015年失败 [英] Installing Entity Framework fails in Visual Studio 2015

查看:466
本文介绍了安装实体框架在Visual Studio 2015年失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在读/编码临ASP.NET MVC 5 由亚当·弗里曼。在第7章(第174页),我们应该使用下面的命令来安装实体框架:

I'm reading/coding along with the Apress book Pro ASP.NET MVC 5 by Adam Freeman. In chapter 7 (p. 174), we're supposed to install Entity Framework using the following commands:

Install-Package EntityFramework -projectname SportsStore.Domain
Install-Package EntityFramework -projectname SportsStore.WebUI

但这种失败。下面是输出:

But this fails. Here is the output:

试图聚集包'EntityFramework.6.1.3'相关性的信息相对于项目的SportsStore.Domain,定位.NETFramework,版本= V4.5.1'结果
  试图解析包'EntityFramework.6.1.3'依赖与DependencyBehavior'最低'结果
  解决措施安装包'EntityFramework.6.1.3结果
  解决安装包'EntityFramework.6.1.3结果行动
  添加包EntityFramework.6.1.3到文件夹C:\\ git的\\ SportsStore \\包'结果
  新增包EntityFramework.6.1.3到文件夹C:\\ git的\\ SportsStore \\包'结果
  新增包EntityFramework.6.1.3'到'packages.config结果
  执行脚本文件C:\\ git的\\ SportsStore \\包\\ EntityFramework.6.1.3 \\工具\\ init.ps1'结果
  执行脚本文件C:\\ git的\\ SportsStore \\包\\ EntityFramework.6.1.3 \\工具\\ install.ps1

Attempting to gather dependencies information for package 'EntityFramework.6.1.3' with respect to project 'SportsStore.Domain', targeting '.NETFramework,Version=v4.5.1'
Attempting to resolve dependencies for package 'EntityFramework.6.1.3' with DependencyBehavior 'Lowest'
Resolving actions to install package 'EntityFramework.6.1.3'
Resolved actions to install package 'EntityFramework.6.1.3'
Adding package 'EntityFramework.6.1.3' to folder 'C:\git\SportsStore\packages'
Added package 'EntityFramework.6.1.3' to folder 'C:\git\SportsStore\packages'
Added package 'EntityFramework.6.1.3' to 'packages.config'
Executing script file 'C:\git\SportsStore\packages\EntityFramework.6.1.3\tools\init.ps1'
Executing script file 'C:\git\SportsStore\packages\EntityFramework.6.1.3\tools\install.ps1'

键入获取帮助的EntityFramework看到所有可用的实体框架命令。结果
  安装成功的EntityFramework 6.1.3来SportsStore.Domain结果
  安装失败。回滚...结果
  去掉包装,从packages.config'的EntityFramework 6.1.3结果
  删除包从文件夹'的EntityFramework 6.1.3''C:\\ git的\\ SportsStore \\包'结果
  访问路径'C:\\ git的\\ SportsStore \\包\\ EntityFramework.6.1.3 \\工具\\ EntityFramework.PowerShell.Utility.dll'被拒绝结果
  到路径EntityFramework.PowerShell.Utility.dll访问被拒绝。结果
  去除包'的EntityFramework 6.1.3从文件夹C:\\ git的\\ SportsStore \\包'结果
  安装封装:具有相同键的项已被添加结果。
  在行:1字符:1结果
  +安装封装的EntityFramework -projectname SportsStore.Domain结果
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~结果
  + CategoryInfo:NotSpecified:(:) [安装封装],异常结果
  + FullyQualifiedErrorId:NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Type 'get-help EntityFramework' to see all available Entity Framework commands.
Successfully installed 'EntityFramework 6.1.3' to SportsStore.Domain
Install failed. Rolling back...
Removed package 'EntityFramework 6.1.3' from 'packages.config'
Removing package 'EntityFramework 6.1.3' from folder 'C:\git\SportsStore\packages'
Access to the path 'C:\git\SportsStore\packages\EntityFramework.6.1.3\tools\EntityFramework.PowerShell.Utility.dll' is denied.
Access to the path 'EntityFramework.PowerShell.Utility.dll' is denied.
Removed package 'EntityFramework 6.1.3' from folder 'C:\git\SportsStore\packages'
Install-Package : An item with the same key has already been added.
At line:1 char:1
+ Install-Package EntityFramework -projectname SportsStore.Domain
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

一个或多个包不能被完全卸载:C:\\ git的\\ SportsStore \\包\\ EntityFramework.6.1.3。重新启动Visual Studio来卸载完成。

One or more packages could not be completely uninstalled: 'C:\git\SportsStore\packages\EntityFramework.6.1.3'. Restart Visual Studio to finish uninstall.

这本书是指导我们安装所有其他库(如 Microsoft.Aspnet.Mvc 5.0.0 )的特定版本,但没有提到EF的哪个版本安装,所以我尝试安装不同版本的EF,但不断收到同样的错误。 (安装失败。回滚...

The book is instructing us to install specific versions of all other libraries (e.g. Microsoft.Aspnet.Mvc 5.0.0), but does not mention which version of EF to install, so I've tried installing different versions of EF, but keep getting the same error. (Install failed. Rolling back...)

我运行VS2015以管理员身份。

I'm running VS2015 as administrator.

推荐答案

似乎的NuGet本身是造成这些问题(可能与 https://github.com/NuGet/Home/issues/1239 ,因为我看到了同样的总是回退问题,因为在该线程讨论)

Seems NuGet itself was causing these issues (probably related to https://github.com/NuGet/Home/issues/1239, as I was seeing the same 'always rolling back' issue as discussed in that thread)

更新的NuGet解决了我。 (从版本 3.0.60624.657 更新为 3.1.60724.766

Updating NuGet solved it for me. (Updated from version 3.0.60624.657 to 3.1.60724.766)

这篇关于安装实体框架在Visual Studio 2015年失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆