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:
- Enable Package Restore to get the .nuget folder (which contains nuget.exe and some nuget.targets file I'll extend)
- Install-Package NuSpec (once per solution, target project doesn't matter)
[-EnablePackageBuild]</strong> (for every project you want to trigger a package build)</li>
</strong> (for every project you want to enable auto-push)</li>
- Uninstall-Package NuSpec (once you're finished with steps 1-4 for the solution)</ol>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.
Leave a Comment