Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio project builds into dll rather than executable

When I build my solution (console app) it creates a dll rather than an executable. Am I doing something wrong or just misunderstanding how this works?

like image 350
smeel Avatar asked Oct 28 '25 02:10

smeel


2 Answers

Right-click on your project in Solution Explorer and select Properties in the bottom of Context Menu. Select proper Output type then as marked on the screendhot.

enter image description here

As mentioned in another answer here: in case your Target framework is .NET Core, use Publish in the Build menu of Visual Studio width setting Target runtime format, for example win-x86 to make a proper output application format.

Check out the reference: Publish your .NET Core application with Visual Studio

like image 76
aepot Avatar answered Oct 30 '25 18:10

aepot


If this is .Net Framework then more than likely the project output type is set to Class Library in the project properties page.

To fix this you must ensure that you have a method with a signature of static void Main() and set the Output type to Console Application.

To Change the Output Type:

  1. Right click the Project name in the Solution Explorer
  2. Select Properties
  3. On the Application tab change Output Type to Console Application
  4. Change the Startup object drop down to the class that contains your Main method.
  5. Save the Properties and try to build/debug again.
like image 45
Jeremey Schrack Avatar answered Oct 30 '25 18:10

Jeremey Schrack