From 6c3e4b763a09955060be042de1be5e29270c79ff Mon Sep 17 00:00:00 2001 From: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com> Date: Fri, 22 Jul 2022 17:07:19 -1000 Subject: [PATCH] what's new top level option --- aspnetcore/release-notes/aspnetcore-7.0.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/aspnetcore/release-notes/aspnetcore-7.0.md b/aspnetcore/release-notes/aspnetcore-7.0.md index 8292b323c017..aca6a95c11f4 100644 --- a/aspnetcore/release-notes/aspnetcore-7.0.md +++ b/aspnetcore/release-notes/aspnetcore-7.0.md @@ -195,3 +195,17 @@ Dark mode support has been added to the developer exception page, thanks to a co In Chrome: ![F12 tools Chrome dark mode](https://user-images.githubusercontent.com/3605364/178082535-7719b77f-563a-4d0d-b70a-267801bb6526.png) + +### Project template option to use Program.Main method instead of top-level statements + +The .NET 7 templates include an option to not use [top-level statements](/dotnet/csharp/fundamentals/program-structure/top-level-statements) and generate a `namespace` and a `Main` method declared on a `Program` class. + +Using the .NET CLI, use the `--use-program-main` option: + +```dotnetcli +dotnet new web --use-program-main +``` + +With Visual Studio, select the new **Do not use top-level statements** checkbox during project creation: + +![checkbox ](https://user-images.githubusercontent.com/3605364/180587645-90f7cce5-d9f8-49d2-88cf-2258960394e1.png)