I'm troubleshooting some issues with specific versions of nuget and msbuild, hence need for downgrading of nuget versions:
Nuget can be updated to latest version with this command:
nuget update -self
However installing a specific version of nuget seems to be unsupported, this still install the latest version of nuget:
nuget update -self -Version 4.6.2
And this fails with nuget not found error:
nuget install nuget -Version 4.6.2
https://docs.microsoft.com/en-us/nuget/tools/cli-ref-install
https://docs.microsoft.com/en-us/nuget/tools/cli-ref-update
EDIT:
Looking at nuget source code the developers made an assumption that update should always happen to the latest version:
// Check to see if an update is needed
if (package == null || version >= package.Version)
Very sad decision, Microsoft! Hence submitted a PR and it was rejected:
How to install a specific version of nuget?
According to the document NuGet CLI reference :
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.
We could to know, NuGet.exe is not an installer. You can just download the version what you want from the nuget.org , then replace the one on the local disk.
Although NuGet team provide the command line nuget update -self
, which can be used to update the nuget.exe
to the latest version, just like what have you said, nuget update command not support update nuget.exe for a specify version. So, I think your PR is reasonable, but it should be at a low priority. Because we can update nuget.exe
by downloading manually.
Hope this clear and helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.