c# - Visual Studio 2019 中的 nuget.exe

标签 c# visual-studio-2017 nuget visual-studio-2019

我的机器上有 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/

相关文章:

c# - 从可为 null 的变量中获取类型

c# - 是否可以使用 NETMF 对嵌入式设备进行编程以将 geochron 记录写入 Azure?

c# - 使用不区分大小写的匹配从 Ftp 服务器下载文件 C#

c++ - 如何避免与 native NuGet 包发生重复的 DLL 冲突?

c# - 重新触发装配解决?

javascript - 在 Visual Studio 2017 中保存或发布时,Typescript 无法编译

c# - 无法在 VS 2017 中使用 C# 6.0 功能

python - 从 CMake 在 Windows/Visual Studio 中以 Debug模式强制链接 Python 发布库

c# - 为什么 PCL NuGet 包无法定位 Xamarin 平台?

.net - Project.json 工具现在应该去哪里?