【问题标题】:How to suppress StyleCop rule SA1515 in Visual Studio for Mac如何在 Visual Studio for Mac 中抑制 StyleCop 规则 SA1515
【发布时间】:2018-03-10 08:39:37
【问题描述】:

在 Visual Studio for Mac 的 Xamarin 项目中,我正在尝试配置 StyleCop。

我已经成功地在 Settings.StyleCop 中抑制了规则 SA1512 SingleLineCommentsMustNotBeFollowedByBlankLine。

我用

<Rule Name="SingleLineCommentsMustNotBeFollowedByBlankLine">
  <RuleSettings>
    <BooleanProperty Name="Enabled">False</BooleanProperty>
  </RuleSettings>
</Rule>

当我尝试用这个来抑制 SA1515 SingleLineCommentsMustBePrecededByBlankLine 时

<Rule Name="SingleLineCommentsMustBePrecededByBlankLine">
  <RuleSettings>
    <BooleanProperty Name="Enabled">False</BooleanProperty>
  </RuleSettings>
</Rule>

它不起作用。我能找到的关于规则名称的唯一文档是this

我是否使用了错误的规则名称?是否存在关于规则名称的任何其他文档或从有关规则 SA1515 的警告到在项目范围内禁止它的任何其他方式?

【问题讨论】:

    标签: xamarin stylecop visual-studio-mac


    【解决方案1】:

    我在 Visual Studio 2017 中遇到了同样的问题。 将规则名称更改为 SingleLineCommentMustBePrecededByBlankLine 最终禁用了该规则。

    【讨论】: