I’ve had the book by Sayed Hashimi and William Bartholomew “Inside the Microsoft Build Engine: Using MSBuild and Team Foundation Build” for more than a year and had to refer to it every time I needed to tailor MSBuild scripts. There are very few books on this subject, and for the time being you have a choice of two books dedicated to MSBuild / Team Build: this one and “MSBuild Trickery” by Brian Kretzler. I haven’t read Brian’s book but judging from the table of contents it’s an MSBuild recipe book. Sayed & William’s book also has various guidelines about performing specific tasks, but in addition it gives a good foundation of MSBuild basic concepts and architecture, providing a deep dive into build targets, properties, use of item groups, environment variables etc. I also own a previous Sayed Hashimi’s book “Deploying .NET Applications: Learning MSBuild and ClickOnce” and used it on different occasions to set up a continuous build and test in my former project, so I knew I wouldn’t be disappointed with the new edition. And I was not.
I think the most important book’s parts are the second (Customizing MSBuild) the third (Advanced MSBuild topics) and the forth (MSBuild cookbook). If you master MSBuild on the level presented in these parts, you will be able to solve difficult project build scenarios. And MSBuild is known for its steep learning curve, so plan to use some time. I also have to admit that whatever I learn about MSBuild I forget within a relatively short time. It’s either something with my memory or MSBuild technology, but in any case I need to have this book around every time I need to work with build scripts. And the book provide a series of recipes that are ready to be used in your project, for example:
- Automatically assigning the assembly version
- Replacing configuration file section values
- Starting and stopping Windows services
- Uploading files to FTP site on successful build
- Deploying Web projects
New in this edition are chapters about building C++ projects (that I didn’t read since I don’t work with C++ these days) and Team Foundation Build. I am not a big fan of Team Foundation Build that in my opinion is over-engineered (look at this 16-pages description of how to override OutDir variable in Team Build), so in case you need to tailor TFS build for your needs, you will most likely have to struggle. I am not sure if a chapter “Team Build Deep Dive” will solve your challenges – in my experience you have to google a lot in order to sort out Team Build related problems – but Sayed and William’s book provides enough to manage a default build set up.
Microsoft recently announced some attractive Azure features to set up a build in the cloud, so I guess we should expect the third edition of this book to cover these topics. However, if you want a sold introduction in MSBuild technology and continuous build on-premises, “Inside the Microsoft Build Engine” is a very good reference book on this topic.