How to publish a NuGet Package to GitHub Packages – The Quick Way

How to publish a NuGet Package to GitHub Packages – The Quick Way

Pieter van der Westhuizen's photo
Pieter van der Westhuizen
·Nov 5, 2020·

2 min read

Play this article

In the previous blog post, How to publish a NuGet Package to GitHub Packages, I’ve shown you hot to publish your NuGet package to GitHub Packages using the NuGet CLI.

Today, I’ll show you a way that is a little bit easier by using the Quick GitHub Package Visual Studio extension by Coalition Software.

Download the extension

Head over to the Visual Studio Marketplace and click on the big green “Download” button. This will download a .vsix file. After the file has downloaded, double-click on it to install it.

image.png

Your Project

First, you must make sure that your project is either configured to generate a NuGet Package when it builds:

image.png

You can also right-click on your project and select “Pack” from the context-menu:

image.png

Initial Setup

Next, right click on your project inside the Visual Studio Solution Explorer and click on “Create GitHub Package

image.png

Setting the NuGet Path

If it is the first time you run the extension, you will be prompted to select the path to the nuget.exe executable:

image.png

Choose the correct path to nuget.exe and click the “Use Selected Path” button to proceed to the next step.

Adding a NuGet source

Next, you’ll be prompted to create a new NuGet source, where the package must be pushed to:

image.png

The entries are explained below:

  • Name – Should be a friendly name for the package source
  • Url – Is the URL to your GitHub organizations’ NuGet package index.json
  • GitHub Username – This should be the username of the GitHub account you’ve created to generate the personal access token above.
  • GitHub Token – This is the personal access token that you created earlier.

After you’ve completed all the necessary information, click on the “Add NuGet Source” button to proceed to the final step.

Publish your NuGet Package to GitHub Packages

After you’ve completed the necessary setup steps. You’ll be able to push your NuGet Package to GitHub Packages. The extension will automatically pick up the path to the .nupkg file.

image.png

All you need to do is to click the “Push GitHub Package” button and it will automatically push the package to your GitHub Packages. ‘

That is it, feel free to download the extension and give it a test. Any problems, please let me know.

Thank you for reading. Until next time, keep coding!

 
Share this