Nuget Publication Checklist
Date Published: 24 January 2019
I have a few Nuget packages that I maintain, and when I get a new PR or add a new feature or bugfix, I like to try and get the change out quickly. Unfortunately, this is a somewhat manual process for me currently, and I don't do it all that often, so I screw it up a high percentage of the time. Or I end up putting it off because it's not something I can just click a button to perform.
This post serves to document the steps I need to take when making an update to an open-source project that has an associated Nuget package. I'll update it as necessary to suit my needs, and hopefully others will find it useful as well. Eventually I'll try to automate it, but for now a manual, error-prone process is improved by a standardized process with a checklist, which in turn is improved by a scripted version of the same process.
- Clone the repository and/or get latest on master.
- Build the solution and run all unit tests.
- Update project csproj file with incremented version number and release notes (e.g.
- Open a terminal window in the project's folder.
dotnet pack -c release /p:Version=1.2.5
- Navigate to the
- Go to NuGet.org in a browser and get publication key - copy it to clipboard.
- In terminal, run
dotnet nuget push -s https://www.nuget.org/api/v2/package -k [key] Ardalis.GuardClauses.1.2.5.nupkgIt will likely take several minutes for the new package to appear in nuget.
- Tag the current commit in git using
git tag -a 1.2.5 -m 'Published 1.2.5 to nuget.org'
- Push the tag to GitHub using
git push --follow-tags
- This should automatically produce a new Release on GitHub as well.
That should do it. You can also blog/tweet about the new release so people know about it.
Steve is an experienced software architect and trainer, focusing currently on ASP.NET Core and Domain-Driven Design.