NuGet软件包丢失 [英] NuGet Packages are missing
问题描述
我搜索了这个问题,但是没有一个解决方案起作用.我已经安装了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
- 我的解决方案中没有.nuget文件夹.
- 我在解决方案中有一个packages文件夹,当我删除它时,似乎NuGet确实重建了依赖关系,但项目仍然存在上述错误.
- 我尝试从TFS中删除该项目,但它没有修复它.
- 伴随上述错误,项目中的所有引用均带有黄色警告标志,并表示缺少它们.
- 当我检查该项目的NuGet软件包管理器时,所有缺失"的项目旁边都有一个绿色的勾,其中包括Microsoft.Net.Compilers.
- 我尝试添加一个新的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屋!