Atom Feed

Create NuGet packages easily

Making NuGet packages is tedious, and I've been looking for an automated solution for doing this for some time. It also turns out that a lot of other people do as well.

Since there are no really good automated solutions out there, I've decided to make one myself. It is not fully automated, but it sure makes things easier when it comes to package creation and publishing.

Basically, you just create a new project in your solution with my template, copy your files into predefined folders in the new project and build that project.

It uses the method described here:  http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-package#From_a_convention_based_working_directory

This package auto-updates to the latest version of NuGet when building. This means your target repository also needs to be the latest version. (Should only be a problem if you're running a custom version of the NuGet Gallery)


  1. Add a new project to your solution by using the installed template
  2. Open NuGet.config and add your repositories to the "packageSources" element.
    The script will then publish your package to all the listed repositories.
  3. Edit the sample "Package.nuspec" file according to http://docs.nuget.org/docs/reference/nuspec-reference
  4. Add the assemblies you want to add as references in the "lib" folder before building the project
    See  http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-package#Package_Conventions
  5. Add the files you want to copy to the project folder in the "content" folder before building the project
    Remember that you can also do config and file transforms. http://docs.nuget.org/docs/creating-packages/configuration-file-and-source-code-transformations
  6. Edit one or more of the files in the "tools" folder if you want to run some script on package install, uninstall or init.
    See  http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-package#Automatically_Running_PowerShell_Scripts_During_Package_Installation_and_Removal  
  7. Build the project.
    1. If in release mode, the packager will try to push your package to the repository using the NuGet API Keys configuration. 
      If no valid API key for the specified package source exists, it will prompt you to add it before automatically trying again.
    2. If in debug mode, it will only create the packages.

If there are .pdb files located in the lib folder, a symbols package will automatically be made and published together with the package.

Make sure all the files you want to include in the package are present in the "lib", "content" and "tools" folders before building the NuGet Packager project.

To publish a new version of your package, bump the version number in the .nuspec file.



Visual Studio Gallery



Updated to work with Visual Studio 2013


Fixed typo reported by Colin Mackay


Fixed bugs reported in comments


Fixed bugs reported in comments


New dialog for entering package repository api keys
Better error handling and logging
Support for pushing to multiple package repositories
Now only uses info from package.nuspec when generating package. (No more AssemblyInfo.cs editing)


Initial release