Tuesday, October 08, 2013

Announcing NuGet.TfsBuild - Private package repository support for TfsBuild

TLDR: NuGet.TfsBuild is a new NuGet package that works with NuGet Package Restore so that private (protected) package repositories can be used with TF Build Services.



A couple of months ago, as an experiment at work, we set up a real project on the cloud-hosted TFService. The goal was to see whether the entire project could be run in the cloud - from work item management, source code control, builds and automated testing. 


Because this was a "REAL" project, we were leveraging NuGet packages from our internal NuGet server - ones that contain proprietary code and couldn't just be shoved onto a public NuGet server. So the packages had to be sourced from a private, protected NuGet server - specifically a private MyGet feed created for the purpose.

But that's where we hit a bit of a snag - we wanted to use TF Build Services to avoid having any specific build server (virtual or physical) - but that means not being able to configure additional NuGet package sources.

You'd think that you could just add the package source to the nuget.exe.config chat gets checked in when Package Restore is enabled - the problem is that the credentials for a private package source are encrypted in the file using a key that's specific to the specific user on the specific machine that's doing the build.

And that would never work with TF Build.

Our solution - a NuGet package that adds an additional build step to the project that reads the package source and credentials from the MSBuild parameters - i.e. from the build DEFINITION rather than either the source, or machine configuration.

The upshot - it just works. The private package source is configured at the start of the build, just before PackageRestore kicks in for the first project being built (usually your "primary" project).

So today I'm very pleased to announce that Landmark Information Group ( http://www.landmark.co.uk /http://twitter.com/LandmarkUK ) have released this little helper package on NuGet.org, with the source code released under the Apache 2.0 license on GitHub.




Fork it, fix it, raise issues, generate pull requests, use it and enjoy it!

No comments: