Visual Studio 2019:如何禁用 .editorconfig 中的特定 CodeAnalysis 消息? [英] Visual Studio 2019: how to disable specific CodeAnalysis messages in .editorconfig?

查看:35
本文介绍了Visual Studio 2019:如何禁用 .editorconfig 中的特定 CodeAnalysis 消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在 VS 2019 .editorconfig 中抑制 CodeAnalysis 消息?这两个选项不起作用:

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 

推荐答案

是的,可以在 Visual Studio 2019 版本 16.3 或更高版本的 EditorConfig 文件中配置规则严重性 (MSDN).

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

要禁止违反规则,您应该将严重性设置为 none:

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

dotnet_diagnostic.CA1051.severity = none

在我编辑配置文件并重新启动 Visual Studio 后,这对我有用.

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

这篇关于Visual Studio 2019:如何禁用 .editorconfig 中的特定 CodeAnalysis 消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆