I’ve just finished having a read through of “Inside the Microsoft Build Engine: Using MSBuild and Team Foundation Build” from MSPress.  I was kind of wondering if there’d be any book left by the time I finished reading the title!

Thankfully there was.  The book is broken into two main sections – the first dealing with MSBuild and then the second on how MSBuild works in a TFS environment and some of the extra things you can do in TeamBuild.

As far as content there’s not a lot of preamble and the book jumps straight into MSBuild features which makes the introductory section a little hard to get your head around if you’re not someone who has dealt with MSBuild before.  I think a short initial section explaining the way MSBuild processes scripts and how it works at a high level would have been a useful precursor to the rest of the book.  But regardless, you can still get up to speed on it quickly, as long as you make sure you take the time to grok what’s explained in the quick start chapter.

After that you get into the meatier stuff.  One of the things I was hoping not to see was an exposé of all the various out of the box tasks that you get with MSBuild as it would have just make the book a reference tome and pretty much worthless as far as I’m concerned.  I’m glad to say this doesn’t happen and instead the book focuses more on the practicalities of build scripts and making sure you understand how to do useful stuff.

It also spends a fair amount of time explaining how the MSBuild scripts work.  MSBuild is pretty damn ugly as far as its syntax is concerned since it’s all XML and requires the liberal use of %’s , @’s and –>’s to signify behaviour. Its very unintuitive and turns off a lot of people right from the start so having a book that explains it (and a lot better than the MSDN docs do) really helps.

The book runs through all of the functionality of MSBuild, including things like developing custom MSBuild tasks and loggers, and in particular has some very useful information on adding batching and incremental builds to your build scripts.  This is one of the least understood areas of MSBuild (probably because the syntax sucks) and to see it well laid out and explained in detail was quite good.

As I mentioned the book tries to be practical with its content and contains cookbook sections to help you with common tasks such as

  • setting assembly versions,
  • starting and stopping services,
  • transferring files via ftp,
  • compressing JavaScript, and
  • encrypting web.config files

It also has useful examples on integrating NUnit & FxCop into your build scripts.

 

The book then moves on to Team Build, with an obvious focus on TFS2008, though it does provide tips on what you could do if you are still using TFS2005.  For example TFS2008 introduced retention policies on builds.  Previously you either had to delete builds manually to stop the disk filling up or automate the cleanup it with an external tool – the book even gives Mitch a plug for the TFS Build Clean up utility he wrote).

As you’d expect the book goes through the details of how Team Build works, explains the different build types and how to customise the process as well as providing another cookbook section so you can get an idea of how to do things such as:

  • generating documentation using sandcastle,
  • load balancing builds across multiple build servers, and
  • adding extra details to the TeamBuild log in Visual Studio

Probably the only thing I was a little disappointed in was the lack of a section on automating deployments after a build completes.  Tools like TFSDeployer can really help streamline the deployment process from TFS and it would have been great to see a few pages devoted to this subject.  I guess you can’t have everything!

 

Summary: A useful reference and guide for both MSBuild and TeamBuild.  It’ll save you hours of digging through and trying to understand the technically correct and practically useless MSDN docs to decipher how to do what you want to do.  The cookbook sections in particular and the practical focus throughout are great and I think it would make a good bookshelf addition for anyone who needs to manage build scripts in a TeamBuild or MSBuild based environment.

Score: 8/10

 

Full disclosure: I obtained this book for free with the intent of doing a review.  I tried not to let the fact that it was a freebie affect my review of the book.