Stylecopanalyzers: How to exclude the analyzer from compilation?

Created on 15 Apr 2016  路  6Comments  路  Source: DotNetAnalyzers/StyleCopAnalyzers

After adding the analyzer from NuGet, I found that the compilation was obviously slowed down by about 100 times for the analyzer generates thousands of warnings.
Is it possible to use it as a real time analyzer only but not in effect when the code is compiled?

question

Most helpful comment

Hello,

We are doing as the recommended approach currently. However, there are too many places that violate the rules and it takes quite some time to fix them.
Out team can endure the analyzer pointing out thousands of warnings when they are coding and they are happy with the analyzer which helps them to keep a good consistency of coding styles, however, they just don't want their productivity being affected by the added compilation time, before those violations being fixed.

All 6 comments

You can disable code analysis for builds by unchecking Enable Code Analysis on Build on the Code Analysis section of the project settings.

@vweijsters I did not check that Enable Code Analysis on Build option at my projects. No matter switching it on or off made no differences. The analyzer still got into effect.

The recommended approach would be the following:

  1. Disable all rules which you do not intend to fix
  2. Fix all violations of the rules which you leave enabled (or use suppressions to stop the warnings of ones you are leaving for some reason)

This will dramatically improve the build performance by eliminating the large number of warnings which are currently being reported.

Hello,

We are doing as the recommended approach currently. However, there are too many places that violate the rules and it takes quite some time to fix them.
Out team can endure the analyzer pointing out thousands of warnings when they are coding and they are happy with the analyzer which helps them to keep a good consistency of coding styles, however, they just don't want their productivity being affected by the added compilation time, before those violations being fixed.

@wmjordan There's a way to disable analyze on build in #1711. I know super late but may be useful to someone.

@Livven Wow what a coincidence, we both ported new info on these ancient issues at the same time! In case you missed it, see my new contribution to https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/1711#issuecomment-419590124, from just now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SurajGupta picture SurajGupta  路  5Comments

mzhukovs picture mzhukovs  路  4Comments

kindermannhubert picture kindermannhubert  路  6Comments

Hylndr picture Hylndr  路  7Comments

Genarij picture Genarij  路  7Comments