You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Should the console project template use top-level statements #27420
For .NET 6, the console project template was changed to use top-level statements. The code that is created in Program.cs is:
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
In earlier versions of .NET and .NET Core, the code that is created in Program.cs is:
using System;
using System.Collections.Generic;
using System.Linq;
namespace MyApp // Note: actual namespace depends on the project name.
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
Discussion about whether this was a good change began in #26313 but there was some confusion about what exactly the various up or down votes applied to. This issue provides comments to vote on that clearly describe the options.
Reacted by Kevin YANG, AFract, David Pine, feynhang, GuoQiang Shi, John Tur, Paul Gualambo, Mads Torgersen, Ockie2002, David Karlaš and 39 more
Reacted by cr, Karl Løland, Michael, Tyler C, Zeljko Vrba, ken2k, Byron2016, KamilahBakery, Dmitrii Khramov, jLGQwBao79R4tnW and 712 more
Up-vote this comment if you would like to be given a choice between top-level statements code and the code created in previous .NET versions.
Reacted by Petr Kulikov, Xymanek, Dylan Perks, Fred Silberberg, Scott, bar10dr, Denis Babarykin, Artur Safiullin, Victor Khotin, Gennady Lyashenko and 1129 more
Reacted by Federico R. Figueredo, Matthew Whited, Died, Matt, Andrew W, Geerten Vink, JesperOlsen, vhe1, Andrew Stanton, thaxy and 44 more
Reacted by Ryan Crosby, marcadia and Gioacchino Piazzolla
I'm sorry in advance, but what about ASP.NET Core templates like -webapi ?
I'd like to have choice between normal Startup.cs and Program.cs vs new Program.cs
Reacted by Denis Babarykin, Victor Khotin, Gennady Lyashenko, Kuinox, Benjamin Crosnier, Issung, githubfanster, symbiotic, Kenji Bradford, Ryouko Konpaku and 84 more
I'm sorry in advance, but what about ASP.NET Core templates like -webapi ?
I'd like to have choice between normal Startup.cs and Program.cs vs new Program.cs
Use the ASP.NET Core 5 templates. Startup is fully supported.
Reacted by Denis Babarykin, Chris Dahlberg, bar10dr, Died, Adam, symbiotic, Lloyd Atkinson, TonuFish, Geerten Vink, Kevin and 42 more
Use the ASP.NET Core 5 templates. Startup is fully supported.
That is only temporary as those templates will be removed once .net core 5 is out of support. So, no, that is not a valid permanent solution to the problem.
Reacted by Artur Safiullin, symbiotic, Denis Babarykin, Adam, dssch, BalazsArva, ken2k, tbrillet, tina-hello, Federico R. Figueredo and 50 more
Reacted by Denis Babarykin, symbiotic, George, Drew Jenkel, ustas7700, Lawrence M., Federico R. Figueredo, itsbeer and joe-oli
@milanjaros Positive feedback from which group? The Python programmers who create 1 micro-microservice for each task? The group who likes the feature but in the end go back and do it in Python? The feedback you need to listen is from C# programmers, not Python programmers. If Python was good no one would use C#.
Reacted by Tanvir Ahmad Arjel, Aptivi CEO, Matthew Whited, Evaldas Povilaitis, Balkoth, Petro, Asbjørn and Ryan Crosby
Reacted by Evaldas Povilaitis, Milan Jaroš, Olivier Spinelli and Ryan Crosby
Reacted by Evaldas Povilaitis, Matthew Whited and Ryan Crosby
Do not support, gild the lily, quickly change back, it is recommended to add this setting in the options, for later generated projects can automatically close this function, thank you
The topic is about project templates. Discussing things like hiring practices or the zune (which was in 2006) is just about as off topic as one could get on this subject. This also includes grievances on other unrelated technologies (like azure functions). If you have feedback on those tools and technologies, there are other suitable locations to bring that up.
Wrt other languages, I can say that that wasn't what we were thinking about when doing these features. As the main designer of one of them (file scoped namespaces), and a codesigner on many others, I can say that it goals were to bring the benefits we found with our REPL experience in c# interactive to the majority of programs.
Clearly the ideas are polarizing for some. So we've provided knobs and options to disable all the things that are not desired. If you're having issues with those, or want to bring up some case that hasn't been considered , please let use know what those cases are. However, please keep those new issues on topic and constructive. We're all devs here, and we can keep things grounded on the project templates. Thanks!
Activity
tdykstra commentedon Dec 6, 2021
Up-vote this comment if you support the use of top-level statements in project templates.
tdykstra commentedon Dec 6, 2021
Up-vote this comment if you prefer project templates to use the code created in previous .NET versions.
tdykstra commentedon Dec 6, 2021
Up-vote this comment if you would like to be given a choice between top-level statements code and the code created in previous .NET versions.
q00Dree commentedon Dec 7, 2021
I'm sorry in advance, but what about ASP.NET Core templates like
-webapi?I'd like to have choice between normal
Startup.cs and Program.csvs newProgram.cstdykstra commentedon Dec 7, 2021
@Rick-Anderson do you want to create a discussion issue like this one in the ASP.NET Core repo?
Rick-Anderson commentedon Dec 7, 2021
Use the ASP.NET Core 5 templates. Startup is fully supported.
bravecobra commentedon Dec 7, 2021
That is only temporary as those templates will be removed once .net core 5 is out of support. So, no, that is not a valid permanent solution to the problem.
823 remaining items
Balkoth commentedon Nov 28, 2022
Updated for .NET7: https://github.com/Balkoth/ClassicConsoleTemplate
ccarlo88 commentedon Nov 28, 2022
@milanjaros Positive feedback from which group? The Python programmers who create 1 micro-microservice for each task? The group who likes the feature but in the end go back and do it in Python? The feedback you need to listen is from C# programmers, not Python programmers. If Python was good no one would use C#.
derempoukas commentedon Nov 28, 2022
Fake simplicity for the sake of looking busy.

This whole idea is the new Clippy
milanjaros commentedon Nov 28, 2022
We can joke about it, and we can disagree about it, but that's all we can do against it.
MrChenLearnSpace commentedon Dec 15, 2022
Do not support, gild the lily, quickly change back, it is recommended to add this setting in the options, for later generated projects can automatically close this function, thank you
Joebeazelman commentedon Dec 19, 2022
ccarlo88 commentedon Dec 19, 2022
derempoukasm commentedon Dec 19, 2022
mwwhited commentedon Dec 19, 2022
mwwhited commentedon Dec 19, 2022
CyrusNajmabadi commentedon Dec 19, 2022
The topic is about project templates. Discussing things like hiring practices or the zune (which was in 2006) is just about as off topic as one could get on this subject. This also includes grievances on other unrelated technologies (like azure functions). If you have feedback on those tools and technologies, there are other suitable locations to bring that up.
Wrt other languages, I can say that that wasn't what we were thinking about when doing these features. As the main designer of one of them (file scoped namespaces), and a codesigner on many others, I can say that it goals were to bring the benefits we found with our REPL experience in c# interactive to the majority of programs.
Clearly the ideas are polarizing for some. So we've provided knobs and options to disable all the things that are not desired. If you're having issues with those, or want to bring up some case that hasn't been considered , please let use know what those cases are. However, please keep those new issues on topic and constructive. We're all devs here, and we can keep things grounded on the project templates. Thanks!
BillWagner commentedon Sep 30, 2025
Closing as this discussion has run its course.