简体   繁体   English

如何在VS2010 Professional中为C#项目自定义代码分析词典?

[英]How do I customize the Code Analysis Dictionary for a C# project in VS2010 Professional?

I've tried following the instructions that the warning message links to , but there is no entry for CodeAnalysisDictionary in the Build Action list. 我已经尝试按照警告消息链接的指示进行操作 ,但是在“构建操作”列表中没有CodeAnalysisDictionary条目。 I've tried manually editing the .csproj file in a similar way to that suggested here for C++ files -- I've added 我尝试以与此处建议的C ++文件类似的方式手动编辑.csproj文件-我已添加

<ItemGroup>
  <Content Include="CustomDictionary.xml" />
</ItemGroup>

after one of the other ItemGroup elements, but that doesn't seem to work either. 在其他ItemGroup元素之一之后,但这似乎也不起作用。

Any ideas? 有任何想法吗?

I'm using the FxCop Integrator extension. 我正在使用FxCop Integrator扩展。 It allows you to right-click on the Solution and choose Code Analysis . 它允许您右键单击解决方案,然后选择代码分析 The other option is More Tasks . 另一个选项是“ 更多任务” Within that More Tasks menu is the ability to edit Edit FxCop Dictionary . 在“ 更多任务”菜单中,可以编辑Edit FxCop Dictionary When I performed the edit, it created a new Solution Folder called Code Analysis containing a new XML file called FxCopDictionary.xml . 当我执行编辑时,它创建了一个名为Code Analysis的新解决方案文件夹,其中包含一个名为FxCopDictionary.xml的新XML文件。 This XML file is set up as one would expect the CustomDictionary.xml file to look like. 该XML文件的设置与CustomDictionary.xml文件的外观相同。

Hope this helps someone out there! 希望这可以帮助某人!

BTW - there's another similar question here: How to get the FxCop custom dictionary to work? 顺便说一句-这里还有另一个类似的问题: 如何使FxCop自定义词典起作用?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM