MSBuild FxCopSolution Task
Objective – Automatically run FxCop on our solution
Possible solution – existing FxCop Community Task
Problems with solution:
- Only compatible with FxCop 1.32 (hard coded folder path!!!)
- Accepts only DLLs as input, not a solution (our solution doesn’t have a single output directory, so the DLLs are scattered)
Solution – writing a custom task called FxCopSolution and tweaking the FxCop task.
For now, I couldn’t get a hold of the lead developer, this is not checked in to the main repository in Tigris. The source code and binaries should be in this zip file.
This zip contains:
- Source – The source for the FxCopSolution task
- Unfortunately the unit tests are not very useful, beacuse it’s currently impossible to actually run the task from inside the tes.
- I included some 3rd party libraries not included in the original MSBuild release, that were needed to compile it (before my changes).
- I had to comment out the Source Safe tasks – they required a lib I didn’t find.
- Bin – Everything needed to deploy the task
- Sample.MSBuild.proj – a sample MSBuild project that uses the task
- Build/MSBuildCommunityTasks – a folder containing the binaries
- Build/fxcop-summary.xsl – an XSL I found somewhere that translates the output from FxCop to a displayable HTML. It’s not that pretty (suggestions are welcome), but it does the job.
We integrated the task with TeamCity (simply adding another MSBuild build and specifying as artifact Build/Output.html), and now our build displays a huge number of FxCop errors we’ll fix in the following weeks.
If you have any errors using the zip (there are bound to be a few silly ones) and/or questions, feel free to contact me at ron.gross@gmail.com.