Nuget package creation harmony with Visual Studio

Over a year ago I opened a post on Nuget’s Codeplex detailing how creating packages, to put it bluntly, just sucked. Nuget has gone through several major releases since then. With current state of Nuget, it’s exceedingly easy to create projects that manage their nuget package creation automatically.

Steps to reach harmony

  1. Right click the solution root in the solution explorer < Enable Nuget Package restore (this should create you a .nuget folder that has nuget.exe in it)
  2. Right click the project you wish to turn into a package, properties and goto the build events tab
  3. In the post build event command line enter:

    “$(SolutionDir).nuget\Nuget.exe” pack “$(ProjectPath)” -Verbose -Properties Configuration=$(ConfigurationName)

Save the project changes, then build your project and you’ll see your packages dropping out in the relevant Bin\Debug or Bin\Release folders!

BloggingContext.ApplicationInstance.CompleteRequest();