nuget

Publish a Nuget Package – 3 Easy Steps

knowventBanner

There are times far and in between where I need to publish a .NET library under a the nuget distribution. However, many times I need to google around trying to find a good example of how to do it.

I am going to self document to the rest the simple step on getting your nuget package published

How to Publish a Nuget Package

1. Setup and Prep Project (skip if you have already done this)

2. Create Your .nupkg File

Use your Nuget.exe tool to generate a .nupkg containing the the .nuspec information

Open a command windows and navigate to your the project file folder. Depending on the relative location of your Nuget.exe file you will want to execute this command:

..\.nuget\NuGet.exe pack

(This assumes my .nuget directory is located one directory down from my project file)

This will create the following file.

Sample.Nuget.Package.1.0.0.0.nupkg

You can use the NuGet Package Explorer you installed earlier to make any changes the NuGet.exe tool got wrong. Simply double click on the .nupkg file to open NuGet Package Explorer, Click “Edit” –> Click “Edit Metadata”.

3. Publish Your .nupkg file

You can publish using your NuGet Package Explorer or command line like this:

../.nuget/nuget.exe setApiKey 00000000-0000-0000-0000-000000000000
../.nuget/nuget.exe push MSample.Nuget.Package.1.0.0.0.nupkg

OR…

For you UI junkies (like me) using NuGet Package Explorer is just as easy. Click “File” –> Click “Publish”. Supply your API Key/Publish Key and Publish.

NOTE: If you haven’t already You will need to go to your Nuget Account page to acquire your API Key/Publish Key.

Publish with Package Explorer


Done.

Comment below if you have any suggestion or incite with your experience with Nuget Publishing

Posted in .NET, Programming and tagged , , , , .