I just pushed out my first production ready library, RandomSelection, to NuGet. I’ve been meaning to publish it for over a year but never got around to it. I honestly thought the process was going to be more involved but in the end it was pretty simple. The library was originally written in .NET 4.X but before I published it I wanted to move it over to .NET Standard. The motivation was to enable its use across a wider range of projects. To make the change I followed three steps.
First, created a new project in Visual Studio 2019 targeting the .NET Standard Library project template.
Second, copied over the classes and project structure from the original project over to the new one.
Third, updated my tests since the library I was using had made a change that impacted my code. Also made small updates to the way I was throwing exceptions so that the message received by the caller would be clear.
That was it. Then to build the NuGet package I used the VS 2019 project properties view to set the parameter values used by NuGet. For a detailed set of instructions to follow take a look at Microsoft’s Create and publish a package using Visual Studio. No need to create your own nuspec file or sign it. Give it a shot. It was amazingly easy.