简体   繁体   English

规则 do.net_style_namespace_match_folder 不起作用

[英]rule dotnet_style_namespace_match_folder doesn't work

My EditorConfig我的编辑配置

# top-most EditorConfig file, hierarchy search will stop in this file
root = true

# ----------------------------------------------------------------------------------------------------------------------
# Coding styles
# ----------------------------------------------------------------------------------------------------------------------

# Dotnet code style settings:
[*.{cs,vb}]
dotnet_diagnostic.IDE0055.severity = error
dotnet_style_namespace_match_folder = true:error

Class I test against. Class 我测试反对。 Namespace should match the structure and be equal to ConsoleApp1命名空间应与结构匹配并等于ConsoleApp1

namespace ConsoleApp1.NotHere
{
    public class Class
    {
        private int X { get; set; } = 0;

        public int Y { get; set; }
    }
}

Solution builds without errors, namespace is not highlighted in VS.解决方案构建没有错误,命名空间未在 VS 中突出显示。 I have checked on fresh console project in .net 6 in VS 2022 and 2019 with latest updates我已经在 VS 2022 和 2019 中检查了 .net 6 中的新控制台项目以及最新更新

VS 2022 Community Version 17.1.1 VS 2022 社区版本 17.1.1

VS 2019 Professional Version 16.11 VS 2019 专业版 16.11

Documentation says it should be available in both IDE, but I cannot make it works. 文档说它应该在两个 IDE 中都可用,但我无法让它工作。 Any ideas?有任何想法吗?

Try using IDE0130 diagnostic id:尝试使用IDE0130诊断 ID:

dotnet_diagnostic.IDE0130.severity = error

Note that syntax option = rule:severity will be sooner or later deprecated .请注意,语法option = rule:severity迟早会被弃用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM