← Back

Publishing Reusable Code on Nuget

These days if your project is not using open source code you are either living under a rock or under very strict project requirements. This post highlights how easy it is to publish your open source package to Nuget with ASP.NET 5 and Visual Studio 2015.

The Roslyn compiler by default will be compiling into memory to keep your builds as fast as possible, however we need output we can publish. Open up the properties of your project and go to the build tab. Make sure “Produce outputs on build” is checked.

produce outputs property

This will make sure the successful build creates a NuGet package (.nupkg) in the Debug or Release directories.

nuget nupkg package

The package can be opened and edited with the NuGet Package Explorer to make sure the details are correct before publishing.

To publish the package login to your account at https://www.nuget.org/ and click on the Upload Package link in the menu bar. Select and upload your .nupkg package, edit any details and submit.

nuget upload

That’s all there is to it. Creating and publishing reusable packages in .NET 5 with Visual Studio 2015 is very straightforward and painless for simple packages. For advanced packages check the documentation here