如何让FxCop自定义字典工作? [英] How to get the FxCop custom dictionary to work?
问题描述
我已经尝试添加要被识别为文件CustomDictionary.xml的单词,其中与FxCop项目文件保持在同一个文件夹中。这似乎不起作用,因为我仍然得到标识符应该拼写正确FxCop消息,即使在重新加载和重新运行FxCop之后。使用版本1.36。
如果在Visual Studio中使用它...
将自定义词典添加到C#和
Visual Basic项目很简单:
- 在解决方案资源管理器中,右键单击项目,然后选择添加 - >新建
项目...
- 在模板下,选择XML文件,输入字典的名称,如$ A
作为CodeAnalysisDictionary.xml,
单击添加
- 在解决方案资源管理器中,右键单击XML文件,然后选择属性
- 在属性工具窗口中的构建操作下,选择
CodeAnalysisDictionary
- 在解决方案资源管理器中,双击新创建的字典到
打开它
在th e XML编辑器,粘贴以下内容,将productname和
companyname替换为您的团队的
等价物:<字典>
< Words>
<认可>
< Word>productname< / Word>
< Word>companyname< / Word>
< /认可>
< / Words>
< / Dictionary>
您现在可以开始输入
你自己的自定义单词。只需在
中的每个单词中添加一个
新元素,您的项目中不存在
的字典。每个单词是
不区分大小写,所以
字的任何外壳都将被识别。代码分析
将在下次运行时自动获取定制的
字典。
How is it possible to get the FxCop custom dictionary to work correctly?
I have tried adding words to be recognised to the file 'CustomDictionary.xml', which is kept in the same folder as the FxCop project file. This does not seem to work, as I still get the 'Identifiers should be spelled correctly' FxCop message, even after reloading and re-running FxCop. Using version 1.36.
If you use it inside Visual Studio...
From Visual Studio Code Analysis Team Blog
To add a custom dictionary to a C# and Visual Basic project is simple:
- In Solution Explorer, right-click on the project and choose Add -> New Item...
- Under Templates, select XML File, enter a name for the dictionary, such as CodeAnalysisDictionary.xml and click Add
- In Solution Explorer, right-click on the XML file and choose Properties
- In the Properties tool window, under Build Action choose CodeAnalysisDictionary
- In Solution Explorer, double-click on the newly created dictionary to open it
In the XML editor, paste the following, replacing "productname" and "companyname" with your team's equivalents:
<Dictionary> <Words> <Recognized> <Word>"productname"</Word> <Word>"companyname"</Word> </Recognized> </Words> </Dictionary>
You are now ready to start entering your own custom words. Simply add a new element for each word in your project that does not exist in the dictionary. Each word is case-insensitive, so any casing of the word will be recognized. Code Analysis will automatically pick up the custom dictionary the next time it is run.
这篇关于如何让FxCop自定义字典工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!