gpt4 book ai didi

c# - CA1701/自定义词典

转载 作者:行者123 更新时间:2023-11-30 16:04:40 25 4
gpt4 key购买 nike

CustomDictionary.xml 中,我应该在哪里/如何放置我的条目以避免来自 VS2015 代码分析的这两个警告?

Warning CA1701 In resource 'xxx.yyy.Properties.Resources.resx', referenced by name 'LoggerMustSpecifyFilename' the discrete term 'Filename' in string value 'Filename must be specified.' should be expressed as a compound word. If 'Filename' refers to an API identifier, case it as 'FileName', otherwise split it into two words separated by a space.

Warning CA1701 In resource 'xxx.yyy.Properties.Resources.resx', referenced by name 'LoggerInvalidFilename' the discrete term 'filename' in string value 'The specified filename '{0}' is invalid.' should be expressed as a compound word. If 'filename' refers to an API identifier, case it as 'fileName', otherwise split it into two words separated by a space.

我不想抑制 CA1701,也不想改变我的字符串大小写。我使用 CustomDictionary.xml 阻止了其他一些警告,它们都工作正常,只是无法摆脱最后两个。

最佳答案

问题是代码分析使用它自己的 CustomDictionary,位于 C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\FxCop或等效的。

这些不能被你自己的字典覆盖。有一个user voice对于这个问题。

特别是对于 Filename,这是导致您的问题的原因:

<?xml version="1.0" encoding="utf-8" ?>
<Dictionary>
<Words>
<Unrecognized>
<!-- .. snip .. -->
</Unrecognized>
<Recognized>
<!-- .. snip .. -->
</Recognized>
<Deprecated>
<!-- .. snip .. -->
</Deprecated>
<Compound>
<!-- .. snip .. -->
<Term CompoundAlternate="FileName">filename</Term>
<!-- .. snip .. -->
</Compound>
<DiscreteExceptions>
<!-- .. snip .. -->
</DiscreteExceptions>
</Words>
<Acronyms>
<CasingExceptions>
<!-- .. snip .. -->
</CasingExceptions>
</Acronyms>
</Dictionary>

(我已经从默认字典中删除了不相关的项目,还有很多)

您可以:

  1. 抑制消息
  2. 更改您的大小写以匹配此自定义词典
  3. 编辑这个默认词典。这特别麻烦,因为您需要在所有开发人员机器和构建服务器上保持同步。

关于c# - CA1701/自定义词典,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34699539/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com