If you are following ASP.NET Core 6, then probably you are aware that with ASP.NET Core 6.0 projects, there is no Startup.cs
file. It is now combined with Program.cs
file to bring unified experience. I posted about How to Add Startup.cs in ASP.NET Core 6 Project and this approach brings Startup.cs
class in the project in a traditional way that we have today with ASP.NET Core 5 and it’s prior version. But what if we can improve things and make it better. Well, in this post, let’s take a look at a clean way to add Startup class in ASP.NET Core 6 projects.
Tag: ASP.NET Core 6
How to add Swagger to ASP.NET Core 6 Application
Swagger is very popular and doesn’t need an introduction. It helps you to test your API. Earlier, I posted about how to add Swagger to ASP.NET Core 2.0 web API and those steps still works for ASP.NET Core 5 based applications where you bring Swashbuckle nuget packages and then add code to Startup.cs
file to enable Swagger. But with ASP.NET Core 6, things have become a little easy and time saving. Now you can easily add swagger to ASP.NET Core 6 application with a mouse click.
How to Add Startup.cs in ASP.NET Core 6 Project
With ASP.NET Core 6.0 projects, you will not find Startup.cs
file. By default, this file is removed and Program.cs
is the new place where you need to register your dependencies and Middleware. But if you are a fan of Startup.cs
or upgrading your project to ASP.NET Core 6.0, you might want back the Startup.cs file. So in this post, let’s find out how to add Startup.cs in ASP.NET Core 6 project.