Globally disabling FxCop errors in TeamCity
Ok, another FxCop question for today.
I've read the arguments regarding the IdentifiersShouldBeCasedCorrectly rule, and whether or not it should be "XML" or "Xml". Well, I'm an "XML" guy and I want to stay that way. Therefore, I do not want FxCop to correct me all of the time.
I have been using the SuppressMessage attribute only for specific cases. I have also used FxCop to mark a ton of errors and copied them as "module" level SuppressMessage statements into assemblyinfo.cs. That works pretty well.
However, now I really want to globally disable this annoying IdentifiersShouldBeCasedCorrectly rule. I'm using TeamCity 5.0.3, and am not using an FxCop project file (however, I could do this). I was hoping that I could pass a parameter to FxCopCmd to tell it to ignore this error, but it doesn't look that way from the documentation.
So... is there anything I can do short of creating an FxCop project file on the TeamCity build server and using it for the FxCop build runner?
No correct solution
Look in the install directory of FxCop (mine is c:/program files/microsoft fxcop 1.36). There should be a CustomDictionary.xml file in that directory. You can add XML to the CasingExceptions section at the end of CustomDictionary.xml and XML casing will be ignored for all namespace and function name elements of all projects on that machine (unless CustomDictionary.xml is overridden on the command line, of course).
You can also copy CustomDictionary.xml to the project directory and add XML in the CasingExceptions secion of the project directory copy. I think that this will be found automatically, with no need of an FxCop project file and will only be used for that project.
That's what I did for our TeamCity build, but I needed an FxCop project file for another reason, so I cannot remember (and cannot check) if CustomDictionary.xml will be found automatically by FxCop.
<Acronyms> <CasingExceptions> <Acronym>Pi</Acronym> <Acronym>Na</Acronym> <!-- NaN --> <Acronym>NESW</Acronym> <!-- North East South West --> <Acronym>NWSE</Acronym> <!-- North West South East --> <Acronym>XML</Acronym> <!-- XML --> </CasingExceptions>
There is also a slightly different example of ignoring words at MSDN FxCop FAQ Hope this helps!