-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
Open
Copy link
Labels
Description
Summary
Add a compiler/MSBuild switch to control which analyzers are executed during build based on their configured severity (e.g., only run analyzers with severity warning or higher).
Motivation
Currently, analyzers configured as suggestion (or silent) still run during dotnet build, even though their diagnostics are not emitted. This adds unnecessary overhead to builds, especially in large solutions with many analyzers. Developers often want these diagnostics visible in the IDE, but not evaluated during command-line builds.
Proposal
Introduce a new MSBuild property or compiler switch, such as:
<PropertyGroup>
<RunAnalyzersWithSeverity>WarningOrAbove</RunAnalyzersWithSeverity>
</PropertyGroup>Related
This request stems from a discussion in dotnet/extensions#7012, where I was investigating why build was so slow in the extensions repo.
Workarounds
- Disabling analyzers entirely during build - will remove the checks we want during development.
- Using custom build configurations to exclude analyzers.
- Swapping .editorconfig files based on context. (complicated and error prone, duplicates content).