How to disable rule SP1516 in Settings.StyleCop?

若如初见. 提交于 2019-12-11 09:43:12

问题


I want to disable this style cop rule

SP1516: Adjacent elements must be separated by a blank line.

How do I do that? What do I write in Settings.StyleCop?


回答1:


The following blog entry by Microsoft StyleCop gives you instructions on how to disable individual rules - Enabling or Disabling StyleCop Rules

  1. Right Click Project -> Source Analysis Settings
  2. Click on the 'Rules' tab
  3. Navigate to the particular rule you want to disable and uncheck it.
  4. Click OK!



回答2:


You can disable it in Settings.StyleCop like this:

<StyleCopSettings Version="105">
  <Analyzers>
    <Analyzer AnalyzerId="StyleCop.CSharp.LayoutRules">
      <Rules>
        <Rule Name="ElementsMustBeSeparatedByBlankLine">
          <RuleSettings>
            <BooleanProperty Name="Enabled">False</BooleanProperty>
          </RuleSettings>
        </Rule>
      </Rules>
    </Analyzer>
  </Analyzers>
</StyleCopSettings>


来源:https://stackoverflow.com/questions/16958321/how-to-disable-rule-sp1516-in-settings-stylecop

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!