Dave Donaldson
Critical thinking in software development
Search
Advertisement
Subscribe
My Tweets
- @willburrus Haven't seen your email. Sorry, thought you would have seen mine earlier.
- @hkarthik I can't get my avatar to look quite like me. Need to spend more time with it I guess.
- Listening to new G 'N R album early on their MySpace page (http://www.myspace.com/gunsnroses). Still formulating an opinion.
- Follow Me on Twitter
Save FxCop Messages to XML Report Only
Wednesday, June 11 2008
Or in other words, how to make FxCop *not* fail your builds...
I've been spending a lot of time lately improving our build processes, part of which includes adding FxCop to our main trunk builds. I've added FxCop into the build process on just about every project I've worked on the last 4 years, but there's always been a problem:
- Every now and then an exception would occur in the build because FxCop tried to save the messages back into the .fxcop project file but couldn't, mainly because the .fxcop file is under source control and is read-only.
I love FxCop, but this issue has always forced me to remove FxCop from the builds because as great as FxCop is, it should *never* be the cause of a broken build. It's never been a huge deal because I run FxCop manually all the time anyway, but it's something I've never been able to workaround. Until now.
You see, all FxCop projects (those .fxcop files) have their own options, separate from the settings of FxCop itself (Project > Options). I've looked at those project options many times before but for some reason I never paid close enough attention to the Save Messages section, shown below with the defaults:
![]() |
What those options are saying is to save the messages into both the project file and the output file that contains the XML for the report. But that's not what we want. We only want the messages saved to the XML output file, not the project file:
![]() |
Like I said earlier, I don't know how I overlooked those particular checkboxes before, but setting them so that the messages are only saved to the XML report solved the problem. And now I'll never have to remove FxCop from a build process again. Happy days.



1 comment(s) so far
Great tip. I've struggled with that exact thing in the past.