gpt4 book ai didi

c# - Visual Studio 不会构建为 exe (.NET Core 2.0)

转载 作者:太空狗 更新时间:2023-10-30 01:13:29 24 4
gpt4 key购买 nike

如果我在 Visual Studio 中有一个基本的 C# 程序,例如

public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}

我在 Visual Studio 中构建项目,得到的是 .dll 而不是 .exe。我查看了项目的属性页,输出类型设置为控制台应用程序。我也尝试过 Windows 应用程序和类库,但它们都创建了一个 dll。如果重要的话,我的 Target 框架是 .NET Core 2.0。不知道还有什么会导致这种情况。

最佳答案

您可以尝试以下步骤:

第 1 步。右键单击项目并单击发布 enter image description here

第二步,选择文件夹->点击发布(或者创建配置文件,就可以了) enter image description here

第 3 步. 点击配置 -> 部署模式:自包含 -> 运行时目标:win-x64 -> 点击保存 enter image description here

第四步,点击发布,你会在目标位置找到.exe文件 enter image description here

顺便说一句,您还可以在 FolderProfile.pubxml 中看到详细信息。希望这可以帮助。 :) enter image description here


更新:我的环境信息:

  1. Visual Studio 2017 (15.7.1)
  2. .NET 核心 2.0

关于c# - Visual Studio 不会构建为 exe (.NET Core 2.0),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50167541/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com