Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Program using top-level statements must be an executable

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

enter image description here

like image 886
Sibeesh Venu Avatar asked Jul 16 '26 23:07

Sibeesh Venu


1 Answers

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.

enter image description here

like image 105
Sibeesh Venu Avatar answered Jul 18 '26 19:07

Sibeesh Venu