c# - StyleCop 镇压

标签 c# .net visual-studio stylecop

是否有可能在更全局的情况下抑制 StyleCop 规则...换句话说,不仅仅是使用源内嵌属性?

最佳答案

您可以使用 Settings.StyleCop 文件禁用某些 stylecop 规则。例如,stylecop 中内置的某些内容不符合我们的标准。例如在我的 Settings.StyleCop 文件中我们有:

<Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.ReadabilityRules">
  <Rules>
    <Rule Name="PrefixLocalCallsWithThis">
      <RuleSettings>
        <BooleanProperty Name="Enabled">False</BooleanProperty>
      </RuleSettings>
    </Rule>
  </Rules>
  <AnalyzerSettings />
</Analyzer>

这样我们就不必在成员变量或属性上有“this”。对于每个人。

关于c# - StyleCop 镇压,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2119681/

相关文章:

c# - C# 中命令行工具的包装器

c# 使用 HtmlAgilityPack 从 HTML 表中获取数据

visual-studio - 无法调试 VSIX 项目 : "Expected export ITextEditorFactoryService but found 0"

c# - 在 Visual Studio 中使用引用调试项目

C# 项目丢失,无论如何要恢复它?

c# - 使用 xamarin studio 进行 windows 7 桌面应用程序开发

c# - ASP.NET JavaScriptSerializer 需要 HttpResponse?

c# - 仅在第一次打印时出现 Hardmargin 的奇怪打印问题 (WinForms)

.net - FOR XML 要求的无效 XML 标识符

c# - 需要从类库读取值App.config