Disable .NET 6 top-level statements on ConsoleApp

How to return old console style, like in .NET 5.0? Visual Studio has disable-button.I love old style.


Hello, there is no such option in Rider. There is a corresponding issue on our tracker: RIDER-79136. As a workaround, I can suggest creating a solution that targets .NET 5 and then changing target.


HI, the given advice to use SDK5 then change to SDK6 no longer works!

I have just hit this exact thing, I want to NOT TURN ON top level statements in a .NET 6 console app and there is no option.

If I create my app as an SDK5 app, I get what's expected:

BUT, if I then go into my properties, there is NO .NET 6 option

.NET 6 is definitely installed on my machine, because I'm allowed to choose it when creating a new project:

When can we get this option added?



Hello Shawty,

This feature is not yet implemented. We have a corresponding issue on our bug tracker. It has not been planned yet. We would appreciate it if you would upvote the issue in order to demonstrate additional interest and bring increased awareness to the issue.

If you have any other questions, do not hesitate to ask. Have a great day!


Already upvoted :-)  5 mins after I originally posted this.

I just also wanted to make a point that the old way of creating an SDK5 then switching to 6 advice you've been using as a workround no longer works.


Can you edit the csproj and remove the


setting - does that work?


Tim Barrass, yes and no.

All that setting does is disable the feature in your project, so that if anyone then tries to create a top level file without the required boiler plate, the compiler will complain.

What we are talking about here in this thread is having the option in the IDE to enable/disable this at project creation time (IE: before csproj is even created)



Yes, it's a workaround, not a fix, but it helps anyone waiting for the fix.


I agree Tim, but it still means that when you create a new project, you have no choice but to create a project that has only the one top line statement in your program.cs file, and thus have to sit and write all the old boiler plate back in by hand.



This worked for me. Created the project manually from command prompt

dotnet new worker -n testworker --use-program-main



I am going back to visual studio because of this issue. This is ludicrous.


Hello Thomas,

Apologies for the inconvenience. We hope to address this issue in future releases. There will be new project creation dialog. Option to avoid top-level statements will be there.


Have a nice day!


I have created project on Visual Studio with low-level. Then open this project with Rider. :)


Please sign in to leave a comment.