New Project Templates for top-level programs in C# 9
See original GitHub issueWith C# 9 on the horizon, we are already able to start building top-level programs in C#:
I think it would make sense to build a new project template that includes a top-level program in C# with a Program.cs file and a csproj file. The code in the Program.cs file would be as simple as this:
using System;
await Console.Out.WriteLineAsync("Hello, World!");
Before I built the PR, I want to ask if this was something your team was willing to consider at this point?
There’s some exciting stuff happening in this space, and it would be great to point people at a simple template to get started. I even saw some of the ASP.NET team on Twitter showing off top-level programs that host a simple HTTP API in a few lines of code.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Top-level statements - C# tutorial
This tutorial shows how you can use top-level statements to experiment and prove concepts while exploring your ideas.
Read more >C# console app template generates top-level statements
The .NET 6+ project template for C# console apps uses top-level statements. Understand what changed and how to use existing learning ...
Read more >Tiny top-level programs with C# 9 and SmallSharp and ...
The template "Console Application" was created successfully ... Right now Visual Studio only supports one top-level program per project.
Read more >How to use top-level programs in C# 9
Click on “Create new project.” In the “Create new project” window, select “Console App (.NET Core)” from the list of templates displayed. Click ......
Read more >Top Level Programs In C# 9 - NET Core Tutorials
A Console Application Today. Start any new console application today from Visual Studio, and you'll see something like this : using ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This was already done for .NET 6. The templates are using top-level programs now. Closing
@seesharprun thank you for the proposal, at the current stage of the .Net 5 release, we are not going to add a new template to the SDK. But you can add it yourself and I will update the list of available templates, maintained by the community. From our side we can include these changes only into our template in the next major .Net release (and C# 10).
I am keeping this issue open.