该项目引用了此计算机上缺少的NuGet软件包 [英] This project references NuGet package(s) that are missing on this computer

查看:470
本文介绍了该项目引用了此计算机上缺少的NuGet软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个昨天运行的ASP.NET MVC5应用程序,现在尝试构建时出现此错误:

I have an ASP.NET MVC5 application that worked yesterday and now I am getting this error when I try to build:

该项目引用了此计算机上缺少的NuGet软件包.

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

我选中了两个选项,它们允许nuget自动下载并安装已丢失的软件包(已选中/已打开).我还尝试删除了packages文件夹中的所有文件,然后让nuget重新下载它们.另外,当我打开nuget并查找更新时,它说没有安装任何内容.我想不出什么其他办法来解决这个令人讨厌的问题.

I have the two options checked that allow nuget to automatically download and install missing packages checked / turned ON. I have also tried deleting all of the files in the packages folder and then have nuget re-download them. Also when I open nuget and look for updates it says there are none that need to be installed. I can't figure what else to do to move beyond this amazingly annoying issue.

推荐答案

就我而言,我必须从.csproj文件中删除以下内容:

In my case, I had to remove the following from the .csproj file:

<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<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>

实际上,在此代码段中,您可以看到错误消息的出处.

In fact, in this snippet you can see where the error message is coming from.

我正在从 MSBuild集成的程序包还原转换为自动程序包还原(( 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆