错误:包还原失败 [英] Error : Package restore failed

查看:31
本文介绍了错误:包还原失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将控制器添加到我在 Asp.net Core 项目中的解决方案中.

I am trying to add controller to my solution in Asp.net Core project.

这样做时,我收到此错误.

While doing so i am getting this error.

我收到相同的消息,为控制器添加最小依赖项和完全依赖项.

I am getting the same message for adding minimal dependencies and full dependencies for controller.

请帮我解决这个问题.提前致谢.

Please help me with this issue. Thanks in advance.

推荐答案

我也遇到了这个问题.添加控制器>带有操作的 API 控制器,使用实体框架"会出现包恢复失败"错误.

I also had this issue. "Add Controller>API Controller with actions, using Entity Framework" would give the "Package Restore Failed" error.

正如 Anish 所说,这似乎是由于软件包版本未对齐.我能够使用管理解决方案的 NUGET 包"解决此问题,然后执行全部更新".这将我的 AspNetCore 版本设置为 2.1.5 并解决了我的Package Restore Failed"错误,但随后导致了另一个错误NETCore version 2.1.5 not found".显然,脚手架代码生成器需要 AspNetCore 和 NETCore 版本同步,所以我从 Microsoft 下载手动下载并安装了 NETCore 2.1.5 版.这奏效了,我终于能够生成控制器了.

As Anish stated, it seems to be due to package versions being mis-aligned. I was able to resolve this issue using "Manage NUGET Packages for Solution", then performing an "Update All". This set my AspNetCore version to 2.1.5 and resolved my "Package Restore Failed" error, but then led to another error, "NETCore version 2.1.5 not found". Apparently the scaffolding code generator needs the AspNetCore and the NETCore versions to be in sync, so I manually downloaded and installed the NETCore version 2.1.5 from Microsoft Downloads. This worked, and I was finally able to generate Controllers.

这篇关于错误:包还原失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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