In a previous post, “Pushing NuGet Packages To An Online Repository with dotnet nuget”, we looked at how to use the dotnet nuget tool to upload packages to a repository.

In this post, we will look at an alternative tool for this purpose - the NuGet client.

You would typically use this if:

  1. You are primarily on the Windows platform
  2. You are still generating and consuming .NET Framework packages
  3. You are working with non-SDK projects

If on Windows, you can download it here: https://dist.nuget.org/win-x86-commandline/latest/nuget.exe

If on macOS, Linux, or Unix, use the instructions here.

Then add it to your PATH to simplify things, or put it in a location that is already in your PATH.

Then you can use it like this:

nuget push *.* -ApiKey YOUR_KEY_HERE -Source https://YOUR_REPOSITORY PATH HERE/

Here, we are doing the following:

  • nuget push invokes the NuGet client
  • *.* indicates we want to push all the files in the current directory
  • -ApiKey indicates the API key to use to authenticate against the repository
  • -Source indicates the source, or where the repository is

If everything is in order, you should see the following:

nugetClient

Personally, I use the dotnet nuget tool- it already comes with the .NET SDK and is one less thing to manage.

TLDR

You can use the NuGet client to publish changes to a NuGet repository.

Happy hacking!