(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...
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.
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)
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.
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.
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:
dotnet pathToDll
on a command lineIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With