简体   繁体   中英

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. Namespace should match the structure and be equal to 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. I have checked on fresh console project in .net 6 in VS 2022 and 2019 with latest updates

VS 2022 Community Version 17.1.1

VS 2019 Professional Version 16.11

Documentation says it should be available in both IDE, but I cannot make it works. Any ideas?

Try using IDE0130 diagnostic id:

dotnet_diagnostic.IDE0130.severity = error

Note that syntax option = rule:severity will be sooner or later deprecated .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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