Visual Studio: temporarily disable StyleCop

前端 未结 5 1892
忘了有多久
忘了有多久 2021-02-19 08:27

Can you disable styleCop in VS?

Scenario:

  1. Press \"Disable StyleCop\" button
  2. Run/debug some test code
  3. The button automatically, enable Sty
5条回答
  •  别跟我提以往
    2021-02-19 09:24

    The most effective way to achieve something like what you want would be to exclude all the files in your project from StyleCop analysis for one build configuration. If you add the following ItemGroup to your project file:

    
        
    
    

    ...that will exclude all .cs files in your project from StyleCop analysis when the "DebugNoStyleCop" configuration is selected. Obviously you can choose some other configuration name that will suit you better by making the appropriate substitution. It's not quite the once-only "off" button that you'd like but it's fairly close.

提交回复
热议问题