Search code examples
c#visual-studioroslynroslyn-code-analysis

Disable Roslyn Analyzer in debug mode


I wanted to know how do I disable all roslyn analyzers in entire solution during debug mode but keep them enable in release mode? I can find references to disable them permanently or individually.


Solution

  • Add the following to the .csproj file of your project:

    <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
        <RunAnalyzers>false</RunAnalyzers>
    </PropertyGroup>
    

    This will disable all analyzers for debug builds, but not for release builds.