-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please document how to change default console template. #26313
Comments
There is no direct way to do this in .NET 6. There are two approaches:
We want feedback. Voting on this issue is one of the ways folks can provide feedback. @tdykstra @BillWagner would you update the docs to indicate this, and let me know if you need anything from me. |
For now, you can do this:
Or, any other older framework. Then, you can change the TFM to .NET 6:
|
Use
This will generate the old-style template but force the framework in the project to net6.0 |
Can you please post a link to where I can vote against this new "feature"? |
@Walluce If you want to suggest that the If you think the whole feature of top-level programs should be removed, then in theory, the right repo would be dotnet/csharplang. But since that feature is not really new (it has been released in C# 9.0 almost a year ago), I don't think a vote against it would have any effect at this point. |
@svick The article asks for feedback as up/down votes on this issue -- see the Template feedback section, The reference is to using top-level statements in the new-project template, not to the top-level statements feature itself. |
This doesn't work :( |
dotnet new web -n Demo -f net5.0 --target-framework-override net6.0 --no-https |
In my opinion, this should be an optional global setting in visual studio. The new style template is ugly and I dont think anyone likes this. Thank you! |
Or provide a multiple .Net 6.0 frameworks (classic and simplified) that provide different initial layouts for the program.cs. |
That's too bad😅 |
Where are args in the new format? How do you use Command Feels like this was not a well-informed decision to change the default template. |
It doesn't feel like the people who built this feature actually build a lot of software from scratch frequently. It feels like you're just showing off what you can do instead of building a tool for professionals to use. This adds several minutes to my startup time every time and takes me out of my flow. |
Yes, this really is complete shit. I just dont understand why this template was changed. Its not logical. I hope if we get enough people complaining it will change. And, per https://docs.microsoft.com/en-us/dotnet/core/tutorials/top-level-templates , this is the page it directs us to to voice our opinion about this template, so this is the correct spot. |
Adding a boolean parameter to each of the templates that toggles between the toplevel statement syntax and the old syntax should be fairly easy. Just a matter of wrapping a few extra lines around the toplevel code. Leave it toplevel default checked if you want. I'll uncheck it myself. The other alternative is writing an analyzer to detect the syntax and having a codefix to wrap the global syntax again. We do want to avoid the compile error having multiple entrypoints though. |
I agree with the sentiments of most of the others responding here - this is an awful change. Please give us a way to make the old template the default, and provide a "create invisible, magic, impossible to understand code-behind" setting for those who like the new template. This has made the simple console template virtually unusable without a lot of extra pushups. |
This template speed up project creating process, but it is completely useless.
For me it is better to allow usage of global functions (it is allowed for C++/CLI)
|
The current trend in technology seems to favaor PFM (pure freaking magic) and in my opinion makes it far harder for someone new to any given technology to understand what is really going on. This is a prime example. As others have said, I would ask that you make this and option. I will certainly choose the option of the old style Program.cs file. |
Please provide an option to make the old style the default. I will go back to the old style every single time. The new style is not readable without experience. |
Have a look at dotnet/csharplang#3117 |
Funny how that issue is locked for comments for being "too heated". |
Any updates from Microsoft? |
C# is becoming more close to python, whats next? run directly .cs files from command line? |
I would use it a lot. |
https://github.com/dotnet/csharplang/blob/main/meetings/2021/LDM-2021-05-12.md#simple-c-programs |
This is confusing. Almost hit the wrong vote because the whole description is misleading. "Template feedback |
Instead of "voting the new template", why can't we have both ? |
Agreed. I suggest we redo the voting, in a new GitHub issue that does not conflict with the page asking for feedback. The page currently says "to voice your support for this feature", but this issue says "Could you please document how we can change the console template back to the 'classic' Program + Main". These votes are ambiguous. This template is less usable, mainly because the arguments and return value are hidden. I'm also concerned about the decision process at Microsoft, behind such a change making it into Visual Studio / .NET. |
The comment in the templates article has been changed from:
to:
|
@tdykstra It may be better to open a new issue, I don't think any vote can be trusted 😁 |
@tdykstra I agree with @adegeo - there are up and down votes splattered across many of the posts to this string and I suspect there was a lot of confusion as to which choice people were making. Please start a new issue with an unequivocal question so that it is completely clear what one is voting for or against. |
See #27420 |
Please just add an option to choose if I want old or new style template instead of sdk switching this is very annoying. |
|
So..where is a nameSpace and class? |
try this |
😂😂 |
Thank you. |
Made a suggested change to the docs with #28223. |
Name that Apptdykstra< Rest Api_curl -I https://api.github.com/users/octocat/orgs |
Could you please document how we can change the console template back to the 'classic' Program + Main.
adegeo EDIT
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: