In preparation of a GraphQL workshop I'm giving later this week, I was updating my demos to .NET 7. The original demos were written in .NET 5, but with the introduction of minimal API's in .NET 6 I decided to take that route. So I removed my Startup.cs
file and copied everything inside my Program.cs
file:
This however resulted in the following error message(which is in fact a warning but I have 'Treat Warnings as Errors' enabled in Visual Studio):
ASP0014: Suggest using top level route registrations
In .NET 6 routes no longer need to be nested inside an UseEndpoints
call, so I can rewrite the code above to get rid of this warning:
More information: ASP0014: Suggest using top level route registrations | Microsoft Learn