C
C#5mo ago
Rhythmic

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?
No description
47 Replies
Unknown User
Unknown User5mo ago
Message Not Public
Sign In & Join Server To View
Rhythmic
Rhythmic5mo ago
I have renamed the project but I still don't get IDE0130
No description
Rhythmic
Rhythmic5mo ago
No description
Angius
Angius5mo ago
Tempora.Classes.Visual.Scrollbars
Unknown User
Unknown User5mo ago
Message Not Public
Sign In & Join Server To View
Rhythmic
Rhythmic5mo ago
I don't understand what you mean.
Unknown User
Unknown User5mo ago
Message Not Public
Sign In & Join Server To View
Rhythmic
Rhythmic5mo ago
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:
No description
Rhythmic
Rhythmic5mo ago
here's the value mentioned:
No description
Rhythmic
Rhythmic5mo ago
this is the correct rule, yes?
Unknown User
Unknown User5mo ago
Message Not Public
Sign In & Join Server To View
Unknown User
Unknown User5mo ago
Message Not Public
Sign In & Join Server To View
Rhythmic
Rhythmic5mo ago
.sln and .csproj is in same folder
No description
Unknown User
Unknown User5mo ago
Message Not Public
Sign In & Join Server To View
Rhythmic
Rhythmic5mo ago
I have now added a solution folder and copied .editorconfig into it. No luck.
No description
Rhythmic
Rhythmic5mo ago
changed to Entire solution. No luck :/
Unknown User
Unknown User5mo ago
Message Not Public
Sign In & Join Server To View
Rhythmic
Rhythmic5mo ago
Hmm, I guess I'll try reinstalling VS
Unknown User
Unknown User5mo ago
Message Not Public
Sign In & Join Server To View
Rhythmic
Rhythmic5mo ago
okie, repairing
Unknown User
Unknown User5mo ago
Message Not Public
Sign In & Join Server To View
Rhythmic
Rhythmic5mo ago
I did trie true:error
Unknown User
Unknown User5mo ago
Message Not Public
Sign In & Join Server To View
Rhythmic
Rhythmic5mo ago
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
Unknown User5mo ago
Message Not Public
Sign In & Join Server To View
Angius
Angius5mo ago
Ah, my bad
Rhythmic
Rhythmic5mo ago
No description
Rhythmic
Rhythmic5mo ago
I assumed to add Tempora.sln to the end
Unknown User
Unknown User5mo ago
Message Not Public
Sign In & Join Server To View
Rhythmic
Rhythmic5mo ago
after this exception I ran dotnet format --verify-no-changes Tempora.sln and the Terminal spammed me with a lot of stuff
Unknown User
Unknown User5mo ago
Message Not Public
Sign In & Join Server To View
Rhythmic
Rhythmic5mo ago
oh haha I can't check VS yet, still repairing
Unknown User
Unknown User5mo ago
Message Not Public
Sign In & Join Server To View
Rhythmic
Rhythmic5mo ago
I added dotnet_diagnostic.IDE0130.severity = error, ran dotnet format again and just noticed this happening:
No description
Rhythmic
Rhythmic5mo ago
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 exception
Rhythmic
Rhythmic5mo ago
No description
Rhythmic
Rhythmic5mo ago
I searched for the exception and it seems to be somehow related to IDE0130
Rhythmic
Rhythmic5mo ago
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...
Rhythmic
Rhythmic5mo ago
This issue is going over my head at this point
Unknown User
Unknown User5mo ago
Message Not Public
Sign In & Join Server To View
Rhythmic
Rhythmic5mo ago
Good news, something changed... but it only gave me these errors for two instances, not for the whole solution
No description
Rhythmic
Rhythmic5mo ago
No description
Rhythmic
Rhythmic5mo ago
No description
Rhythmic
Rhythmic5mo ago
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
Unknown User5mo ago
Message Not Public
Sign In & Join Server To View
Rhythmic
Rhythmic5mo ago
Thanks for the help in any case
Want results from more Discord servers?
Add your server
More Posts