在 TeamCity 中全局禁用 FxCop 错误
好的,今天还有一个 FxCop 问题。
我已经阅读了有关 IdentifiersShouldBeCasedCorrectly 规则的争论,以及它是否应该是“XML”或“Xml”。嗯,我是一个“XML”人,并且我想保持这种状态。因此,我不希望 FxCop 一直纠正我。
我仅在特定情况下使用 SuppressMessage 属性。我还使用 FxCop 标记大量错误,并将它们作为“模块”级 SuppressMessage 语句复制到 assemblyinfo.cs 中。这效果很好。
但是,现在我真的想全局禁用这个烦人的 IdentifiersShouldBeCasedCorrectly 规则。我正在使用 TeamCity 5.0.3,并且没有使用 FxCop 项目文件(但是,我可以执行此操作)。我希望可以向 FxCopCmd 传递一个参数来告诉它忽略此错误,但从文档中看起来并非如此。
那么...除了在 TeamCity 构建服务器上创建 FxCop 项目文件并将其用于 FxCop 构建运行程序之外,我还能做些什么吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看FxCop的安装目录(我的是c:/program files/microsoft fxcop 1.36)。该目录中应该有一个 CustomDictionary.xml 文件。您可以将 XML 添加到 CustomDictionary.xml 末尾的 CasingExceptions 部分,并且该计算机上所有项目的所有命名空间和函数名称元素都将忽略 XML 大小写(当然,除非在命令行上覆盖 CustomDictionary.xml)。
您还可以将 CustomDictionary.xml 复制到项目目录,并在项目目录副本的 CasingExceptions 部分中添加 XML。我认为这将自动找到,不需要 FxCop 项目文件,并且仅用于该项目。
这就是我为 TeamCity 构建所做的,但由于另一个原因我需要 FxCop 项目文件,因此我不记得(也无法检查)FxCop 是否会自动找到 CustomDictionary.xml。
例子:
MSDN FxCop 中还有一个略有不同的忽略单词的示例常见问题解答
希望这有帮助!
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.
Example:
There is also a slightly different example of ignoring words at MSDN FxCop FAQ
Hope this helps!