【发布时间】:2020-02-03 20:00:00
【问题描述】:
我的机器上有 VS2017 和 VS2019。我在 VS2019 解决方案资源管理器中缺少很多 nuget 引用(黄色图标)。我试过恢复 Nuget 包,我看到了:
All packages are already installed and there is nothing to restore.
Time Elapsed: 00:00:00.0560466
========== Finished ==========
我进入包管理器控制台并尝试执行以下操作:
nuget restore MySolution.sln
得到一个
nuget : The term 'nuget' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path
is correct and try again.
At line:1 char:1
我在硬盘上环顾四周,只看到 nuget.exe 存在于 C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\SqlChangeAutomation\OctoPack\build\NuGet.exe 中
为什么2019年也不存在?
谢谢
【问题讨论】:
-
因为Visual Studio可以简单的使用客户端库nuget.org/packages/NuGet.Client,不一定是nuget.exe。
-
有时,如果您在项目的“参考”选项下单击缺少的参考(黄色参考),Visual Studio 会“看到”它们。
-
据我所知,如果你想在包管理控制台中使用nuget.exe,你应该设置
nuget.exe的路径,你可以从Marcus的链接下载到环境变量的PATH .如果答案确实有帮助,请考虑接受。这只是一个提醒:) -
包管理器控制台,使用powershell命令docs.microsoft.com/en-us/nuget/reference/powershell-reference
标签: c# visual-studio-2017 nuget visual-studio-2019