roslyn: IDE0130 not showing as warnings in VS 16.10.3

Version Used: Visual Studio 2019 16.10.3

Steps to Reproduce:

  1. In VS 2019 (v 16.10.3), create a new C# project targeting .Net 5.0
  2. Add a new .editorconfig file. This automatically includes dotnet_style_namespace_match_folder = true
  3. Change the namespace of any class so that it doesn’t match the folder name

Expected Behavior: The IDE should show warnings for IDE0130

Actual Behavior: No warnings are shown for IDE0130

I have also tried changing the severity of the rule with each of the following lines in .editorconfig

  • dotnet_analyzer_diagnostic.severity = warning
  • dotnet_diagnostic.IDE0130.severity = warning

I have also tried referencing the Microsoft.CodeAnalysis.NetAnalyzers nuget package version 5.0.3.

In short, I think this is a feature that has been released since VS 2019 16.10.0 but I’m not sure how to get it working. Are there any extra configuration steps that need to be done?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

Was there something changed for the rule dotnet_style_namespace_match_folder? I can’t get it to show up in Visual Studio 2022 v17.0.6. I’ve tried all the suggestions in the comments here.

Looks like it was a miss on branch targeting. Jon has taken to fixing for me, thankfully https://github.com/dotnet/sdk/pull/18748