我的机器上有 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 下也不存在?
谢谢
最佳答案
您可以从 here 下载 Nuget.exe .
将 Nuget.exe 复制到您保存工具的位置。然后我建议在 PATH 系统变量中输入保存 Nuget.exe 的位置。
我会尝试清除 nuget 缓存。您可以使用以下命令执行此操作:
nuget locals all -clear
这可确保再次下载所有包。
您不能在包管理器控制台中调用 Nuget.exe。为此,您必须打开一个控制台 session 并切换到您的解决方案目录以执行所需的命令。
nuget restore MySolution.sln
最重要的是,如果您稍微浏览一下 Nuget 文档页面,这也非常有帮助。您可以找到它们 here .
我希望我能对你有所帮助,并指导你走上可能的道路。
最好的祝愿
关于c# - Visual Studio 2019 中的 nuget.exe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60046334/