Scripts for Package Restore and Package Creation for Team Build 2013

Topics: General
Sep 18, 2013 at 4:22 PM
Edited Sep 18, 2013 at 4:48 PM
I had put together a custom Team Build 2012 Build Template to support creating NuGet packages as part of a Team Build. It was working for me but there were a lot of tweaks involved and it felt a bit fragile, so I didn't feel comfortable publicizing it for others to use.

Team Build 2013 and the new Build Template makes it much easier. I've uploaded the scripts I'm using that leverage the Pre and Post build script options added to the Team Build 2013 Build Process.

NovaBuild is the name of the project. It does two key things:

1) Pre-Build runs Package Restore so any NuGet packages you might use that plug into the MSBuild Process (SlowCheetah, etc...) work as expected
2) Post-Build packages any Projects in the Solution that have a .nuspec sitting beside it.

Feedback and bug reports welcome. I publish my packages to a local file server, not to the official NuGet repository, but changing that is a simple exercise if you need to do it.
Sep 19, 2013 at 6:37 PM
Very cool. Are you using the nuget.exe restore command in the Pre-build step?
Sep 20, 2013 at 12:33 AM
Yep. "nuget restore" for the package restoration, it's just a 4 line PowerShell script if that's all someone wanted to do:
$nuget = "$srcDir\.nuget\nuget.exe"
[string[]]$parms = @("restore", "$srcDir\NovaFramework.sln")
& $nuget $parms
I also just added support for setting version info in a shared VersionInfo.cs. This way, all of the -IncludeReferencedProjects project versions are correctly picked up during packaging. A solution with multiple NuGet packages is building completely in Team Build with external and Project references and it's pretty straight-forward.
Sep 24, 2013 at 12:12 AM
Great stuff.
Sep 24, 2013 at 12:14 AM
Btw, we have an NuGet ecosystem page on our docs site (, in which we list all known NuGet-related projects and services. If you're interested in adding your build template to it, you're welcome to send a pull request for it. The project code for the docs site is hosted on GitHub (