Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio won't build to exe (.NET Core 2.0)

If I have a basic C# program in Visual Studio such as

public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}

And I build the project in Visual Studio, I get a .dll instead of a .exe. I've looked in the properties page for the project, and the Output type is set to Console Application. I've tried Windows Application and Class library too but they all create a dll. If it matters, my Target framework is .NET Core 2.0. Not sure what else would be causing this.

like image 264
Benjamin Creem Avatar asked May 04 '18 05:05

Benjamin Creem


1 Answers

You could try following step:

Step 1. Right click project and click publish enter image description here

Step 2. Select folder -> click publish(or create profile, it is ok) enter image description here

Step 3. click configure -> Deployment mode:self-contained -> runtime target:win-x64 -> click save enter image description here

Step 4. click publish, you will find .exe file under your target location enter image description here

Btw, you also see the detail in FolderProfile.pubxml. Hope this helps. :) enter image description here


Update: My environment info:

  1. Visual studio 2017 (15.7.1)
  2. .NET Core 2.0

like image 133
Duran Hsieh Avatar answered Sep 30 '22 22:09

Duran Hsieh