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.
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.
First, you must make sure that your project is either configured to generate a NuGet Package when it builds:
You can also right-click on your project and select “Pack” from the context-menu:
Next, right click on your project inside the Visual Studio Solution Explorer and click on “Create GitHub Package”
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:
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:
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.
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!