简体   繁体   English

NuGet包恢复已启用但我收到错误,说它未启用

[英]NuGet Package restore IS enabled but I get an error saying it's not enabled

I have nuget package restore enabled in my solution. 我在我的解决方案中启用了nuget包恢复。 However, when I try to build the project, I get this error: 但是,当我尝试构建项目时,我收到此错误:

This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.

Any ideas how to fix this problem? 任何想法如何解决这个问题?

I have tried deleting my NuGet.targets and NuGet.exe file and re-enabling nugget package restore. 我尝试删除我的NuGet.targets和NuGet.exe文件并重新启用nugget包还原。 It recreates the files and I get the same error. 它重新创建文件,我得到相同的错误。

Try and see if this helps: 试着看看这是否有帮助:

in solution explorer, right click on the project name and select 'Enable Nudget package restore' 在解决方案资源管理器中,右键单击项目名称并选择“启用Nudget包还原”

also remember to rebuild each of your projects 还记得重建你的每个项目

wait until it gets restored and run the project if it works fine 等到它恢复并运行项目,如果它正常工作

Please follow below mentioned steps: 请按照以下步骤操作:

Step 1: Please enable Nuget Package Restore by right clicking on solution [as mentioned in below screenshot] 第1步:请右键点击解决方案启用Nuget Package Restore [如下面的屏幕截图所示]

启用Nuget包还原

Step 2: [Follow this if the issue / error is not resolved by following step 1] Still if you face the issue, please open .csproj file in notepad and check for the package path which might look like 第2步:[如果问题/错误未通过以下步骤1解决,请执行此操作]如果您遇到问题,请在记事本中打开.csproj文件并检查可能看起来像的包路径

包路径

So your solutions directory structure will be like: \\SolutionDirectory\\ 所以你的解决方案目录结构将是:\\ SolutionDirectory \\

Package Directory \\SolutionDirectory\\packages 包目录\\ SolutionDirectory \\ packages

Project Directory \\SolutionDirectory\\ProjectName\\ProjectName.csproj 项目目录\\ SolutionDirectory \\ ProjectName \\ ProjectName.csproj

Please open this .csproj [in which you're getting error in notepad and search for packages path and update it to its relevant path. 请打开这个.csproj [你在记事本中遇到错误并搜索包路径并将其更新到相关路径。

For eg my .csproj contained, if .csproj file contains ....\\packages then update that path with ..\\packages 例如我的.csproj包含,如果.csproj文件包含.... \\ packages然后用.. \\ packages更新该路径

I had already done what the blog post recommends (through the options menu) and it still didn't build. 我已经完成了博客文章推荐的内容(通过选项菜单),但仍然没有构建。

In the end I removed the Microsoft.Net.Http Nuget Package and Reinstalled it and that fixed it. 最后,我删除了Microsoft.Net.Http Nuget Package并重新安装它并修复了它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM