No namespace = folder warnings in VS
I don't get
IDE0130
warnings in my C# project (namespace does not match folder structure).
Here's an example of a .cs file which should give me the warning:
using OsuTimer.Classes.Utility;
namespace OsuTimer.Classes.Visual;
public partial class BlockAmountScrollBar : LabeledScrollbar
{
//Code omitted
}
The script is in a subsfolder called "Scrollbars", so the namespace does not match the folder name. See picture
I have ensured .editorconfig has dotnet_style_namespace_match_folder= true
I have added <EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
in <PropertyGroup>...</PropertyGroup>
to my .csproj
I have restarted VS and built the solution.
I have run Analyze -> Run Code Analysis -> On Solution
Any ideas?47 Replies
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
I have renamed the project but I still don't get
IDE0130
Tempora.Classes.Visual.Scrollbars
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
I don't understand what you mean.
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
Visual Studio's editconfig GUI editor doesn't work for me, even if I explicitly tell it to open with the default GUI editor.
So I edit the value in text. The .editorconfig text editor you see here is what pops up when I open with default GUI editor:
here's the value mentioned:
this is the correct rule, yes?
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
.sln and .csproj is in same folder
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
I have now added a solution folder and copied .editorconfig into it. No luck.
changed to Entire solution. No luck :/
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
Hmm, I guess I'll try reinstalling VS
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
okie, repairing
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
I did trie true:error
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
First time hearing about CI. As for "Tools - Options - Text Editor - C# - Advanced" I set both Analysis options to "Entire Solution"
waiting for repair rn
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
Ah, my bad
I assumed to add
Tempora.sln
to the endUnknown User•11mo ago
Message Not Public
Sign In & Join Server To View
after this exception I ran
dotnet format --verify-no-changes Tempora.sln
and the Terminal spammed me with a lot of stuffUnknown User•11mo ago
Message Not Public
Sign In & Join Server To View
oh haha
I can't check VS yet, still repairing
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
I added
dotnet_diagnostic.IDE0130.severity = error
, ran dotnet format again and just noticed this happening:So I guess that's good
So is
dotnet format
basically the same as VS Code Cleanup?
I ran it without --verif-no-changes
and get this exceptionI searched for the exception and it seems to be somehow related to
IDE0130
GitHub
Wrong IDE0130 message "Namespace 'Foo' does not match folder struct...
This issue has been moved from a ticket on Developer Community. [regression] [worked-in:16.11?] I have a .NET 5.0 project which has app which has default namespace 'Microsoft.BigSolutionGenerat...
This issue is going over my head at this point
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
Good news, something changed... but it only gave me these errors for two instances, not for the whole solution
it seems to not care if the namespace is a parent folder
I expect an error because it's not
namespace Tempora.Classes.Visual.Scrollbars
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
Thanks for the help in any case