Thursday, July 12, 2012

NuGet

NuGet is a great extension to Visual Studio that makes it easier to manage third party libraries used in your .NET solutions. If you have Visual Studio 2010 NuGet is installed via the extension manager and if you are using Visual Studio 2012 NuGet is already pre-installed.

NuGet out of the box is set up to retrieve packages from the NuGet gallery, but you can add your own local NuGet feeds as well, for information look here. It's also possible to host your own NuGet feed at myget.org.

General steps for creating a NuGet package from a Visual Studio project:
1. Download and install NuGet.exe.
2. Create a project for your package (remember to add info to AssemblyCompany in AssemblyInfo.cs)
3. Run 'nuget spec' in the folder of your project to create a nuspec file for your project
4. Update your created .nuspec file (Release notes, projectURL etc.)
5. Run 'nuget pack' in the folder of your project to create the .nupkg file for your project package.

For a more detailed description on how to create and publish your own NuGet package, look here.

You can find a great introduction to NuGet by Phil Haack presented at NDC Oslo 2012 here and there is also NuGet documentation available. Also look at the MSDN article Manage Project Libraries NuGet.

To understand how versioning is handled by NuGet take a look at semantic versioning.

No comments: