How to run Nuget Package Manager Host in cmd / powershell

和自甴很熟 提交于 2019-12-11 08:28:50

问题


I am currently using Update-Package command in Visual Studio 2017 Nuget Package Manager Console. I need to use it from command prompt

eg:

nuget Update-Package Newtonsoft.Json 

回答1:


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.

If your goal is just to script updates to packages, as long as you're not impacted by any limitations or package compatibility isseues, you can consider migrating to SDK-style projects and PackageReference instead of packages.config, then you can use dotnet outdated to script your updates.




回答2:


You can follow the below guidelines by Microsoft:

1) Visit nuget.org/downloads and select NuGet 3.3 or higher (2.8.6 is not compatible with Mono). The latest version is always recommended, and 4.1.0+ is required to publish packages to nuget.org.

2) Each download is the nuget.exe file directly. Instruct your browser to save the file to a folder of your choice. The file is not an installer; you won't see anything if you run it directly from the browser.

3) Add the folder where you placed nuget.exe to your PATH environment variable to use the CLI tool from anywhere.

So, basically in your computer properties > Global Variables, you need to add path of Nuget.exe and then you can run the Nuget commands from Command Line Interface.

For further Clarifications you can refer link: https://docs.microsoft.com/en-us/nuget/tools/nuget-exe-cli-reference



来源:https://stackoverflow.com/questions/53912572/how-to-run-nuget-package-manager-host-in-cmd-powershell

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!