简体   繁体   English

Visual Studio 2017和缺少的EXE文件

[英]Visual Studio 2017 and a missing EXE file

(I am using Visual Studio 2017.) (我使用的是Visual Studio 2017.)

I started a small console application. 我开始了一个小型的控制台应用 A Discord C# bot. 一个Discord C#bot。 So I always launched this program with Visual Studio. 所以我总是用Visual Studio启动这个程序。 After finishing it, I wanted to put the .exe file on a server, to keep this bot stay online all day long. 完成后,我想将.exe文件放在服务器上,以保持这个机器人整天保持在线状态。

In the directory, there isn't any .exe file. 在目录中,没有任何.exe文件。

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" “C:\\ Program Files \\ dotnet”,此.exe称为“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). 当我想手动启动这个.exe文件时,它立即关闭(可能是因为缺少代码行Console.ReadLine();我不知道)。

What should I change in Visual Studios settings to have an .exe file in my correct directory for my console application? 我应该在Visual Studios设置中更改哪个.exe文件在我的控制台应用程序的正确目录中?

The attached picture shows my bin directory, where the .exe file should normally be. 附图显示了我的bin目录,通常应该是.exe文件。 There is a .dll file, but I need the .exe file... 有.dll文件,但我需要.exe文件...

在此输入图像描述

There is no exe file because you created a .NET Core application. 没有exe文件,因为您创建了.NET Core应用程序。

You have two options: 您有两种选择:

  1. If you want an EXE, you need to target the .NET Framework. 如果需要EXE,则需要以.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 如果您不想更改代码,则需要在服务器上安装.NET Core并在命令行上运行dotnet pathToDll

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM