Visual Studio 2022 throws error when building the Web API project as Program using top-level statements must be an executable

The issue was that the output type of the Web API project was set to Class Library instead of Console Application, changing that fixed the issue. You can get into the screen by right-click on the project and by selecting Properties.

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With