Reputation: 1590
(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...
Upvotes: 6
Views: 19503
Reputation: 32062
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 lineUpvotes: 17