48

How can we create the exe for a console forms application ?

being fab
  • 657
  • 3
  • 12
  • 22

5 Answers5

60

an EXE file is created as long as you build the project. you can usually find this on the debug folder of you project.

C:\Users\username\Documents\Visual Studio 2012\Projects\ProjectName\bin\Debug
John Woo
  • 258,903
  • 69
  • 498
  • 492
  • okk i found it, actually i was asked to create an exe for my console app, but is it the same exe i found in debug folder?? – being fab Oct 15 '12 at 04:34
  • 1
    Well it depends on the settings, if you set your project in debug mode it will be in the debug folder, if its in the release mode, you will have a release folder under bin which will contain the exe – Chandra Sekhar Walajapet Oct 15 '12 at 04:36
  • @beingfab, it is the same one, The output type of Console application is an executable file. `*.exe`. – Habib Oct 15 '12 at 04:39
  • @beingfab, click on that exe and check same result your getting from it or not – andy Oct 15 '12 at 04:46
  • 16
    Wrong, all I get is a pdb file, a dll and some json files. No exe. – Nathan McKaskle Jun 12 '17 at 14:11
  • I've got the same output as Nathan - dll and json file - no exe. No trouble building an exe for a winform app, but that's not what this post is about. – alexb Feb 04 '18 at 02:17
  • 2
    @NathanMckaskle .Net Core will only create a .dll. To get an exe check out this thread: https://stackoverflow.com/questions/44074121/build-net-core-console-application-to-output-an-exe?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa – Kenttleton Apr 30 '18 at 18:08
13

For .net core 2.1 console application, the following approaches worked for me:

1 - from CLI (after building the application and navigating to debug or release folders based on the build type specified):

dotnet appName.dll

2 - from Visual Studio

R.C solution and click publish
'Target location' -> 'configure' ->
   'Deployment Mode' = 'Self-Contained'
   'Target Runtime' = 'win-x64 or win-x86 depending on the OS'

References:

For an in depth explanation of all the deployment options available for .net core applications, checkout the following articles:

Saif Asad
  • 779
  • 10
  • 8
  • Good, but I needed to right click the project, not the solution. And needed to create a new FolderProfile. – Andrew Nov 17 '19 at 23:04
6

Normally, the exe can be found in the debug folder, as suggested previously, but not in the release folder, that is disabled by default in my configuration. If you want to activate the release folder, you can do this: BUILD->Batch Build And activate the "build" checkbox in the release configuration. When you click the build button, the exe with some dependencies will be generated. Now you can copy and use it.

King Midas
  • 1,442
  • 4
  • 29
  • 50
6

For .NET Core 2.2 you can publish the application and set the target to be a self-contained executable.

In Visual Studio right click your console application project. Select publish to folder and set the profile settings like so:

Visual Studio Publish Menu

You'll find your compiled code with the .exe in the publish folder.

Yodacheese
  • 4,787
  • 5
  • 34
  • 42
-6

The following steps are necessary to create .exe i.e. executable files which are as 1) Open visual studio framework 2) Then, create a new project or application 3) Build or execute your application by pressing F5