Install-NuSpec & Enable-PackagePush: create, build & push NuGet packages anywhere

This short post is basically combining some of my recent posts (this one and that one) into one. Actually, into one single NuGet package :)

Basically, this one single package will allow me to automate and speed up package creation and publication, and it will run anywhere you can run the NuGet command line, because I only use nuget.exe and MSBuild to perform these actions. To set it up, I use a NuGet package (Install-Package NuSpec) and some PowerShell, but that's only to put the pieces of the puzzle in the right place, and give you some commands in Visual Studio. Once you're done, simply uninstall the package.

So, in short:

  1. Enable Package Restore to get the .nuget folder (which contains nuget.exe and some nuget.targets file I'll extend)
  2. Install-Package NuSpec (once per solution, target project doesn't matter)
  3. Install-NuSpec [-EnablePackageBuild] (for every project you want to trigger a package build)
  4. Enable-PackagePush (for every project you want to enable auto-push)
  5. Uninstall-Package NuSpec (once you're finished with steps 1-4 for the solution)
A more detailed Readme is available on Github (where the sources are if you fancy some PowerShell).
The package can be found on NuGet.

If you're using MyGet already, you simply need to set the feedname and your own personal API-key in the NuGet.Extensions.targets file you'll find under the $(SolutionDir).nuget folder. If you're not using MyGet, simply replace the entire PushPkgSource and SymbolsPkgSource URLs by the one of your choosing.

Sharing is caring

Posted by Xavier Decoster on
Last revised: 27 Oct, 2012 09:46 PM
blog comments powered by Disqus