此项目引用此计算机上缺少的NuGet包.

Sre*_*ree 1 nuget visual-studio-2015

在我的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.

Sre*_*ree 7

通过从.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>
Run Code Online (Sandbox Code Playgroud)