此项目引用此计算机上缺少的 NuGet 包 [英] This project references NuGet package(s) that are missing on this computer
问题描述
我有一个昨天运行的 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 自动下载和安装丢失的软件包.我还尝试删除包文件夹中的所有文件,然后让 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.
我还通过右键单击项目并选择该选项来启用 nuget 恢复.然后它添加了一个 nuget 文件夹和该文件夹中的三个项目,但没有解决问题.我已经尝试重新构建,但仍然出现相同的错误.
I have also enabled nuget restore by right clicking the project and selecting that option. It then added a nuget folder and three items in that folder and does nothing to resolve the problem. I've tried re-building and still get the same error.
推荐答案
就我而言,我不得不从 .csproj 文件中删除以下内容:
In my case, I had to remove the following from the .csproj file:
<Import Project="$(SolutionDir).nugetNuGet.targets" Condition="Exists('$(SolutionDir).nugetNuGet.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).nugetNuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir).nugetNuGet.targets'))" />
</Target>
事实上,在这个片段中,您可以看到错误消息的来源.
In fact, in this snippet you can see where the error message is coming from.
我正在从 MSBuild-Integrated Package Restore 转换为 Automatic Package Restore (http://docs.nuget.org/docs/workflows/migrating-to-automatic-package-restore)
I was converting from MSBuild-Integrated Package Restore to Automatic Package Restore (http://docs.nuget.org/docs/workflows/migrating-to-automatic-package-restore)
这篇关于此项目引用此计算机上缺少的 NuGet 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!