如何在cmd/powershell中运行Nuget Package Manager主机 [英] How to run Nuget Package Manager Host in cmd / powershell
问题描述
我当前在Visual Studio 2017 Nuget软件包管理器控制台中使用 Update-Package 命令.我需要在命令提示符下使用它
I am currently using Update-Package command in Visual Studio 2017 Nuget Package Manager Console. I need to use it from command prompt
例如:
nuget Update-Package Newtonsoft.Json
推荐答案
Visual Studio的Package Manager控制台仅在Visual Studio中可用.NuGet cmdlet与Visual Studio本身进行交互以读取/修改您的项目文件,因此该实现无法在其他Powershell主机中按原样工作.
Visual Studio's Package Manager Console is only available in Visual Studio. The NuGet cmdlets interacts with Visual Studio itself to read/modify your project file, so that implementation can't work as-is in other powershell hosts.
如果您的目标只是编写脚本更新程序包,只要您不受任何软件包兼容性问题,您可以考虑迁移到SDK样式的项目和 PackageReference
packages.config
,那么您可以使用 dotnet过时代码>
编写更新脚本.
If your goal is just to script updates to packages, as long as you're not impacted by any limitations or package compatibility issues, you can consider migrating to SDK-style projects and PackageReference
instead of packages.config
, then you can use dotnet outdated
to script your updates.
这篇关于如何在cmd/powershell中运行Nuget Package Manager主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!