#5916·NLog

Enable Dotnet Code Analysis by default

Author: snakefootCreated Jul 3, 2025Updated Apr 5, 2026
Labelsup-for-grabsrefactoring

Turn on dotnet code analysis in the NLog-project

xml
    <EnableNETAnalyzers>true</EnableNETAnalyzers>
    <AnalysisLevel>latest</AnalysisLevel>
    <AnalysisMode>recommended</AnalysisMode>

Consider updating .editorconfig-file to adjust severity, when it makes sense. Example:

dotnet_diagnostic.CA1001.severity = suggestion      # CA1001: Type owns disposable field(s) but is not disposable
dotnet_diagnostic.CA1848.severity = suggestion      # CA1848: For improved performance, use the LoggerMessage delegates
dotnet_diagnostic.CA1707.severity = none            # CA1707: Remove underscores from member name
dotnet_diagnostic.IDE0130.severity = none           # IDE0130: Namespace does not match folder structure