Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force Visual Studio 2022 create console projects with namespaces and classes (like in old good days)?

Just switched to VS2022, created new project and see this:

// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");

Where is all other stuff? Why is that by default now?

like image 971
Alek Depler Avatar asked Sep 06 '25 03:09

Alek Depler


1 Answers

There is an option now, to disable top-level statements:

enter image description here

I just tried it and it produces an old-style project. :-)
You also don't loose file-scoped namespaces, they still work.

like image 168
Xan-Kun Clark-Davis Avatar answered Sep 09 '25 22:09

Xan-Kun Clark-Davis