HowSoftwareTech

How to install the NuGet gallery in Powershell

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/

nuget stat
Here are some figures on the Nuget platform

Install Nuget on Windows Server 2016, Windows Server 2019 and 2022

To install the packages you must open a Powershell command prompt as administrator

powershell in administrator mode

Then enter the following command

Install-PackageProvider -Name NuGet

Press “Yes for All” to start the installation (letter T).

install powershell nuget package

The installation must proceed correctly:

nuget installation ok
Here the installation was successful.

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

Powershell Nuget error

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.

Powershell TLS 1.2

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.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button

Adblock Detected

Please consider supporting us by disabling your ad blocker