在我的 Visual Studio 2015 更新 3 中,将解决方案文件夹复制到另一台 Windows 计算机时遇到以下错误。

错误 此项目引用了此计算机上缺少的 NuGet 包。使用 NuGet Package Restore 来下载它们。有关更多信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105 。丢失的文件是 ..\packages\Microsoft.Net.Compilers.1.0.0\build**Microsoft.Net.Compilers.props.**

我验证了项目的 NuGet 包管理器,所有标记为“缺失”的东西旁边都有一个绿色的勾,包括 Microsoft.Net.Compilers。

最佳答案

通过从 .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-2015 - 此项目引用此计算机上缺少的 NuGet 包。,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/44455011/

10-11 22:22
查看更多