Follow below steps.
Open Visual Studio 2022.
Click Create a new project.
Search for ASP.NET Core Empty.
Select the ASP.NET Core Empty template and click Next.
Choose .NET 8.0 as the target framework.
Click Create.
This template will give you the setup with just the Program.cs and Startup.cs , and no Razor Pages or MVC.