gpt4 book ai didi

visual-studio - NuGet 包丢失

转载 作者:行者123 更新时间:2023-12-03 04:01:50 37 4
gpt4 key购买 nike

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

我收到以下错误:

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 文件中删除此代码解决了我的问题:

<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>

关于visual-studio - NuGet 包丢失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32254439/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com