Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
276 views
in Technique[技术] by (71.8m points)

c# - 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 Filesdotnet" 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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...