FxCop - Setting up FxCop
http://msdn.microsoft.com/msdnmag/issues/04/06/Bugslayer/default.aspx
http://www.gotdotnet.com/team/fxcop/Docs/FxCopApp/FxCopApp_Projects.html
Here is a good article on using FxCop from the GUI.
But we will be using it from the command line...
If you've never read on how to use FxCop from the command line, start with this good tutorial.
I also was happy to find this documentation about built in variables.
I'm not sure where you can download an FxCop later than 1.35.
But on your hard-drive, if you are using VS2008, you'll find a copy in
C:\Program Files\Microsoft Visual Studio 9.0\Team Tools\Static Analysis Tools\FxCop.
This obviously brings up an important question: if FxCop comes with VS2008,
but you don't want to install a licensed copy of this very very expensive software on a server
box, how is CruiseControl.NET going to run FxCop?
I ran the VS2008 copy and found that it was listed as version 1.36...which is a little later than the one
I could find <a href="http://www.gotdotnet.com/Team/FxCop/">here</a>.
At time of writing, I found a reference to a 1.36beta mentioned, that can be downloaded here.
In other words, on your server, you are going to have to install this beta on your CruiseControl.NET box.
Although I had the VS2008 copy already there on my machine (in C:\Program Files\Microsoft Visual Studio 9.0\Team Tools\Static Analysis Tools\FxCop),
I wanted to setup my computer in the same way as on the server, so I downloaded and installed the
package onto my workstation and installed it to c:\Program Files\Microsoft FxCop
(note that I stripped off the suggested default path of c:\Program Files\Microsoft FxCop 1.36 after the error I saw with NUnit's versioned path...).
Right. So I'm now ready to mess around with the build file...
FxCopCmd /f:SomeAssembly.dll /r:"C:\Rules Directory\SomeRules.dll" /o:OutputFile.xml
<!-- Run FxCop analysis -->
<!-- All on one line please: folded for blogging purposes only -->
<Exec Command="c:\Program Files\Microsoft FxCop\FxCopCmd.exe
/f:C:\depot\Bank\Bank.FxCop /out:C:\depot\Bank\Bank.FxCop.xml"
WorkingDirectory="C:\Program Files\Microsoft FxCop 1.30" />