Roman Pokrovskij
Roman Pokrovskij

Reputation: 9776

Visual Studio 2019: how to disable specific CodeAnalysis messages in .editorconfig?

Is it possible to suppress CodeAnalysis messages in VS 2019 .editorconfig ? These two options don't work:

[*.cs]
#Trying alternatives to
#[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1051:Do not declare visible instance fields", Justification = "<Pending>")]
dotnet_diagnostic.CA1051.severity = silent 
dotnet_analyzer_diagnostic.CA1051.severity = silent 

Upvotes: 4

Views: 3845

Answers (1)

Stephen Kennedy
Stephen Kennedy

Reputation: 21558

Yes, rule severity is configurable in an EditorConfig file in Visual Studio 2019 version 16.3 or newer (MSDN).

To suppress a rule violation, you should set the severity to none:

dotnet_diagnostic.CA1051.severity = none

This worked for me after I edited the config file and restarted Visual Studio.

Upvotes: 9

Related Questions