缺少 NuGet 包 [英] NuGet Packages are missing

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

问题描述

我搜索了这个问题,但没有一个解决方案有效.我安装了 Visual Studio Professional 2015 并且正在使用 TFS.我的 NuGet 版本是 3.1.6.这个问题只发生在我的 C# Web API/MVC 项目中.

I searched this problem but none of the solutions worked. I have Visual Studio Professional 2015 installed and I am using TFS. My NuGet version is 3.1.6. This problem is happening only in my C# Web API/MVC project.

我收到以下错误:

此项目引用了此项目中缺少的 NuGet 包计算机.使用 NuGet Package Restore 来下载它们.更多信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105.这丢失的文件是..packagesMicrosoft.Net.Compilers.1.0.0uildMicrosoft.Net.Compilers.props

This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..packagesMicrosoft.Net.Compilers.1.0.0uildMicrosoft.Net.Compilers.props

  1. 我的解决方案中没有 .nuget 文件夹.
  2. 我在解决方案中有一个包文件夹,当我删除它时,NuGet 似乎确实重建了依赖项,但项目仍然存在上述错误.
  3. 我尝试从 TFS 中删除该项目,但没有修复.
  4. 除了上述错误外,项目中的所有引用都有黄色警告标志并表示它们丢失了.
  5. 当我检查项目的 NuGet 包管理器时,所有缺失"的东西旁边都有一个绿色的勾,包括 Microsoft.Net.Compilers.
  6. 我尝试添加一个新的 Web API/MVC 项目,但它遇到了类似的问题,即 Owin 等大多数引用都丢失"并带有黄色警告标志.

推荐答案

我今天遇到了同样的错误(缺少完全相同的包).我还创建了一个 MVC + Web API 项目.

I had the same error (missing exactly the same package) today. I also created a MVC + Web API project.

发生这种情况是因为我将应用程序文件(包括 .csproj)文件移动到了另一个位置.我手动更新了 .sln 文件,但所有包依赖项现在(Visual Studio 2015)都存储在 .csproj 文件中.

It happened because I moved the app files (including the .csproj) file to another location. I manually updated the .sln file but all packages dependencies are now (Visual Studio 2015) stored in .csproj file.

编辑 .csproj 文件并更正解决方案文件夹(包含包文件夹)的相对路径为我解决了问题.

Editing the .csproj file and correcting the relative path to the solution folder (which contains the packages folder) solved the problem for me.

这篇关于缺少 NuGet 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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