Search code examples
c#visual-studio-code.net-6.0program-entry-point

How to enable auto-generating main method when creating console application in VS Code in C#


In .NET 6.0, the Main method is simplified by removing and main method. Now it's possible to start writing code directly without it.

But I want to enable it back and don't want to write it by hand every time when new project is created. I'm using VS Code, but I couldn't find any straight way to accomplish this.

Is there any option for this or any shortcut like writing "prop" to create property quickly.


Solution

  • With your cursor on the code that it starts with, you can press Ctrl+., and click "Convert to 'Program.Main' style program" example