Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2017 and a missing EXE file

(I am using Visual Studio 2017.)

I started a small console application. A Discord C# bot. So I always launched this program with Visual Studio. After finishing it, I wanted to put the .exe file on a server, to keep this bot stay online all day long.

In the directory, there isn't any .exe file.

So I started the application again and saw this console is opened from a different path:

"C:\Program Files\dotnet" and this .exe is called "dotnet.exe"

When I want to start this .exe file manually, it closes instantly (maybe because of the missing line of code Console.ReadLine(); I don't know).

What should I change in Visual Studios settings to have an .exe file in my correct directory for my console application?

The attached picture shows my bin directory, where the .exe file should normally be. There is a .dll file, but I need the .exe file...

Enter image description here

like image 439
peterHasemann Avatar asked May 26 '17 12:05

peterHasemann


People also ask

Where is the EXE file in Visual Studio?

In Visual Studio, select File > Open > Project. In the Open Project dialog box, select All Project Files, if not already selected, in the dropdown next to File name. Navigate to the .exe file, select it, and select Open. The file appears in a new, temporary Visual Studio solution.

How can I run EXE file in Visual Studio 2017?

Open the solution. Right-click on project you want to compile into exe -> Properties. Configuration Properties -> General. In Project Defaults change Configuration Type to Application(.exe)

How do I restore exe files?

To resolve this problem, reset the registry subkey for the file association of the .exe file back to the default setting. To do this, follow these steps: To open the Task Manager, press CTRL + SHIFT + ESC. Click File, press CTRL and click New Task (Run...) at the same time.

Why can't I find the EXE file?

If the app's EXE file isn't easily available you can browse two locations either C:\Program Files or C:\Program Files (x86) on your system to find the application's main program folder. Then look for the folder with the name that's similar to the publisher of the program. Or the name of the application itself.


1 Answers

Updated answer:

When this answer was written, back in 2017, .NET Core only output dll files, this has since changed. This can now be achieved with this property in the application's csproj:

<OutputType>Exe</OutputType>

There are also additional deployment methods like the single-file deployment.


Original answer:

There is no exe file because you created a .NET Core application.

You have two options:

  1. If you want an EXE, you need to target the .NET Framework.
  2. If you don't want to change your code, then you need to install .NET Core on the server and run dotnet pathToDll on a command line
like image 142
Camilo Terevinto Avatar answered Oct 24 '22 00:10

Camilo Terevinto