When using the Powershell language you may be brought to download new Galleries.
These Galleries thus make it possible to download other features such as the WebClient for “remote gateways” type servers.
A few days ago I had some difficulty in install the Nuget package. Here is a tutorial on how to install it successfully the first time!
But what is Nuget?
NuGet is the package manager for .NET. NuGet client tools allow you to produce and install packages.
The NuGet gallery is quite simply the central repository of packages used by all package authors and consumers.
It is also possible to use CLI tools as well as NuGet functionality in Visual Studio.
The tool is available from Windows Server 2012 until the latest version Windows Server 2022.
However it is highly recommended to have an up-to-date server to use the NuGet gallery.
The official website is available at this address: https://www.nuget.org/
Install Nuget on Windows Server 2016, Windows Server 2019 and 2022
To install the packages you must open a Powershell command prompt as administrator
Then enter the following command
Install-PackageProvider -Name NuGet
Press “Yes for All” to start the installation (letter T).
The installation must proceed correctly:
Troubleshoot Nuget installation errors
As I told you I had some difficulties especially on Windows Server 2016.
Indeed during the installation I encountered this nice error message
To resolve this error it is necessary activate TLS 1.2 on your server.
Here is the command to enter:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
You can try to install the Nug package again and it should work.
For later versions like Windows Server 2019 or the new Windows Server 2022 I didn’t have any problems so I imagine the servers are already in TLS 1.2.
Sometimes by installing new applications, Powershell will go directly download Nuget, if you get an error message it is probably related to the TLS version.