Search code examples
c#.netvisual-studio.net-6.0editorconfig

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?


Solution

  • Try using IDE0130 diagnostic id:

    dotnet_diagnostic.IDE0130.severity = error