Member-only story

How to create a NuGet package and publish it using an automated build pipeline

Ron Jonkers
11 min readJan 27, 2021

--

In this post I will teach you how to publish a NuGet package to nuget.org using an automated build pipeline in Azure DevOps.

Where we left off in the last post

In the last post I created a library that allows users to unit test classes that use HttpClient. Now I want to make this library available for various projects, by creating a NuGet package. I finished the last post with a solution consisting of three projects:

  • MockHttpClient
  • PseudoClient
  • PseudoClient.Tests

I have removed the two PseudoClient projects from the solution. As the name suggests they only contained pseudo code and they no longer served any purpose. Afterwards I created a repository at GitHub and pushed the code to it.

Considerations to make when creating a NuGet package

When you decide to create a NuGet package, it is important to think about the audience for your package. The work that you put into your package might be significantly more if you publish it to a public feed, compared to when you publish it to a private feed.

When you add a package to nuget.org you might want to document your code, keep a changelog and write a readme. If you are the only consumer of the package, the overhead might not be worth the effort, because you know the internals…

--

--

Ron Jonkers
Ron Jonkers

Written by Ron Jonkers

Husband, father, crypto enthusiast and software developer.

No responses yet