Is it possible to turn off file-scoped namespaces in newly created files?



I've switched my project to .NET 6 and C# 10 and now every new Class/Interface/Enum file is created with file-scoped namespace. Is it somehow possible to turn this feature off and keep files created in C# 9 style?
I've tried to disable Reformat option in Class File template, create custom Code Cleanup with "Arange namespaces" disabled, disable "To file-scoped namespace" context action. None of this works.


Hello David, could you please check Namespaces settings in Syntax style and change it if required?


I overlooked this option in first time, thank you very much. Have a nice day.


Ok but is seems that this option only display hints but when you create a new C# project it's still in that demented, yes I'm that pissed, file-scoped style? Is there some way how to have new project with block-scoped classes?


Hello Ondrej Valenta, thank you for your question. Do I understand correctly that you do not want a file with top-level statements to be created when creating a new C# project? If so, then please comment or vote for the following YouTrack issue. If I've missed something, please let me know. Thank you!


Please sign in to leave a comment.