This project references NuGet package(s) that are missing on this computer.

使用Visual Studio打开Asp.Net Web项目的时候,发现项目中所有的引用都变成了

                          

所有的引用都变成了不可用状态,找到如下解决办法:

  打开项目的.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).nugetNuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir).nugetNuGet.targets'))" />
</Target>

  将其删除,重新加载项目即可。

原文地址:https://www.cnblogs.com/Herzog3/p/6133106.html