【问题标题】:How do we suppress a diagnostic rule for a specific file in editorconfig Visual Studio我们如何在 editorconfig Visual Studio 中抑制特定文件的诊断规则
【发布时间】:2020-04-28 07:01:05
【问题描述】:

我正在尝试在诊断扫描时抑制编辑器配置中的文件。

下面是我的代码,谁能帮忙。

[*.File.cs] generated_code = true

【问题讨论】:

    标签: visual-studio roslyn-code-analysis diagnostics editorconfig


    【解决方案1】:

    此功能是在问题发布后于 2020 年 3 月 16 日 VS 版本 16.5 中添加的。

    在重新启动 VS 后,我得到了以下工作,因为 UI 有时会保留检测到的错误,即使 .editorconfig 说忽略它。 在我的 /migrations/.editorconfig 文件中:

    [*.cs]
    generated_code = true
    

    您现在可以选择在运行分析器时排除生成的文件或文件夹。创建一个 EditorConfig 文件并使用以下语法将所需的文件或文件夹标记为生成:

    EditorConfig 选项排除生成的文件或文件夹

    https://docs.microsoft.com/da-dk/visualstudio/releases/2019/release-notes#exclude-generated-files-folders

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-07-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-14
      • 1970-01-01
      • 2019-05-20
      • 1970-01-01
      相关资源
      最近更新 更多