在 TeamCity 中全局禁用 FxCop 错误 [英] Globally disabling FxCop errors in TeamCity

查看:27
本文介绍了在 TeamCity 中全局禁用 FxCop 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,今天的另一个 FxCop 问题.

Ok, another FxCop question for today.

我已经阅读了关于 IdentifiersShouldBeCasedCorrectly 规则的参数,以及它应该是XML"还是Xml".嗯,我是一个XML"人,我想保持这种状态.因此,我希望 FxCop 一直纠正我.

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.

我一直只在特定情况下使用 SuppressMessage 属性.我还使用 FxCop 标记了大量错误,并将它们作为模块"级 SuppressMessage 语句复制到 assemblyinfo.cs 中.效果很好.

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.

然而,现在我真的想全局禁用这个烦人的 IdentifiersShouldBeCasedCorrectly 规则.我使用的是 TeamCity 5.0.3,并且没有使用 FxCop 项目文件(但是,我可以这样做).我希望我可以将一个参数传递给 FxCopCmd 以告诉它忽略此错误,但从文档中看并非如此.

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.

那么...除了在 TeamCity 构建服务器上创建 FxCop 项目文件并将其用于 FxCop 构建运行器之外,我还能做些什么吗?

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?

推荐答案

查看 FxCop 的安装目录(我的是 c:/program files/microsoft fxcop 1.36).该目录中应该有一个 CustomDictionary.xml 文件.您可以将 XML 添加到 CustomDictionary.xml 末尾的 CasingExceptions 部分,该机器上所有项目的所有命名空间和函数名称元素的 XML 大小写将被忽略(当然,除非 CustomDictionary.xml 在命令行上被覆盖).

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).

您也可以将 CustomDictionary.xml 复制到项目目录,并在项目目录副本的 CasingExceptions 部分添加 XML.我认为这会自动找到,不需要 FxCop 项目文件,只会用于该项目.

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.

这就是我为 TeamCity 构建所做的,但由于另一个原因我需要一个 FxCop 项目文件,所以我不记得(也无法检查)FxCop 是否会自动找到 CustomDictionary.xml.

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>

MSDN FxCop 常见问题解答希望这会有所帮助!

There is also a slightly different example of ignoring words at MSDN FxCop FAQ Hope this helps!

这篇关于在 TeamCity 中全局禁用 FxCop 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆