views:

461

answers:

3

I am looking for any and all suggestions of the best and effective resources that the StackOverflow community has used to better learn MSBuild with an emphasis on integrating unit tests and later static code analysis tools such as FxCop and StyleCop into the build process.

I have tried to find good clear documentation on adding unit tests into my build but I still am searching - even Google searches have come up empty or with just bits and pieces. Ideally I want to add unit tests, report results, and eventually add code coverage statistics, etc into the build results.

I know it has to be in MSDN somewhere but I seem unable to find anything which explains and teaches well. I am using Visual Studio Team System 2008.

+4  A: 

Continuous Integration From Theory to Practice by Carel Lotz. It covers the entire scope of your problem, and then some. Well written, complete, and a full sample are all there.

Hands down best resource. Use it as a tutorial first, then use it as a guide, then use it as a reference.

MSDN and others are good for clarifying (or confusing) the details.

Edit: The guide by Carel Lotz uses MBUnit for unit tests (see his earlier document version for NUnit, though you can replace the MBUnit with NUnit pretty easily if you follow the NUnit help files).

Also, it is written to use Cruise Control.NET to run the MSBuild script in various configurations.

Personally, I run unit tests in a secondary MSBuild script, but have found that wrapping the NUnit calls in MSBuild gives more flexibility than running from CCNet directly.

Rob Hunter
Wow - excellent answer - you are right - that is an excellent reference - even extends to areas I wanted to know more about next (such as how to make MSBuild run in parallel) - I will check in tomorrow but this is certainly a great candidate to mark as my accepted answer - Thanks Rob
Brad Osterloo
A: 
silverbugg
Good question as I would tend to look at CruiseControl based on its user community but yes - my mandate is that we use Team System to its fullest and so I am focusing my efforts there - but good MSBuild tutorials seem difficult for me to find
Brad Osterloo
A: 

Here's a book that might help: http://blogs.msdn.com/microsoft_press/archive/2009/01/31/sayed.aspx