NuGet软件包丢失 [英] NuGet Packages are missing

查看:238
本文介绍了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软件包还原下载它们.欲了解更多 有关信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105 .这 丢失的文件是 .. \ packages \ Microsoft.Net.Compilers.1.0.0 \ build \ Microsoft.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 ..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props

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

推荐答案

我通过从.csproj文件中删除以下代码来解决了我的问题:

I solved my issue by removing this code from .csproj file:

<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
  <PropertyGroup>
    <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
  </PropertyGroup>
  <Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>

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

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