简体   繁体   English

在netcoreapp3.0控制台应用程序中,默认情况下会生成myprogram.exe(带扩展名exe)。 它是什么?

[英]In netcoreapp3.0 console application, myprogram.exe (with extension exe) is generated by default. What is it?

I have the following simple project: 我有以下简单的项目:

<Project Sdk="Microsoft.NET.Sdk">

 <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <LangVersion>8.0</LangVersion>
 </PropertyGroup>
 </Project>

In netcoreapp3.0: 在netcoreapp3.0中:

When run 'dotnet build', I find a file myprogram.dll is generated with size 5k plus myprogram.exe is generated with size 239k 当运行'dotnet build'时,我发现生成了一个大小为5k的myprogram.dll文件,生成了大小为239k的myprogram.exe

In netcoreapp2.2: 在netcoreapp2.2中:

The myprogram.exe isn't generated. 未生成myprogram.exe。

I can run the program : 我可以运行程序:

    dotnet myprogram.dll

Or 要么

    myprogram.exe //it need .netcore be installed.

Why are the the two files: myprogram.exe and myprogram.dll is generated in netcoreapp3.0, but in netcoreapp2.2 only myprogram.dll is generated? 为什么这两个文件:myprogram.exe和myprogram.dll是在netcoreapp3.0中生成的,但是在netcoreapp2.2中只生成了myprogram.dll?

From https://devblogs.microsoft.com/dotnet/announcing-net-core-3-preview-1-and-open-sourcing-windows-desktop-frameworks/ 来自https://devblogs.microsoft.com/dotnet/announcing-net-core-3-preview-1-and-open-sourcing-windows-desktop-frameworks/

NET Core applications are now built with executables. NET Core应用程序现在使用可执行文件构建。 This is new for applications that use a globally installed version of .NET Core. 这对于使用全局安装的.NET Core版本的应用程序来说是新的。 Until now, only self-contained applications had executables. 到目前为止,只有自包含的应用程序具有可执行文件。 You can see executables produced in the following examples. 您可以看到以下示例中生成的可执行文件。

You can expect the same things with these executables as you would other native executables, such as: 对于这些可执行文件,您可以期望与其他本机可执行文件相同的内容,例如:

  • You can double click on the executable. 您可以双击可执行文件。
  • You can launch the application from a command prompt without using the dotnet tool, using myconsole.exe, on Windows, and ./myconsole, on Linux and macOS, as you can see in the following examples. 您可以在不使用dotnet工具的情况下从命令提示符启动应用程序,在Windows上使用myconsole.exe,在Linux和macOS上使用./myconsole,如以下示例所示。

So, it is just a more convenient way to use the program. 因此,它只是一种使用该程序的更方便的方法。 You don't need to use a command line such as dotnet myapp.dll to start the application. 您不需要使用命令行(如dotnet myapp.dll来启动应用程序。 You can run the exe. 你可以运行exe。

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

相关问题 使用 netcoreapp3.0 安装 dotnet-ef 时遇到问题 - Facing Issue while Installing dotnet-ef with netcoreapp3.0 约束引用“字符串”无法解析为类型。 (netcoreapp3.0) - The constraint reference 'string' could not be resolved to a type. (netcoreapp3.0) 控制台应用程序发布 exe - Console Application Release exe 从Windows窗体应用程序将数据读/写到exe生成的控制台 - Read/Write data to Console generated by exe from windows form application 无法为面向 netcoreapp3.0 的 ASP.NET Core WebApp 中的特定 API 控制器启用 CORS - Can't enable CORS for specific API controllers in ASP.NET Core WebApp targeting netcoreapp3.0 为什么 Path.GetFullPath 返回带有额外“bin/Debug/netcoreapp3.0”的地址? - Why Path.GetFullPath returns the address with extra "bin/Debug/netcoreapp3.0"? 如何创建控制台应用程序的exe - How to create exe of a console application 运行没有.exe扩展名的外部应用程序 - Run external application with no .exe extension 将目标从 netcoreapp3.0 更改为 netstandard2.1 时缺少 TableAttribute - TableAttribute is missing when change target from netcoreapp3.0 to netstandard2.1 从.NET控制台应用程序打开.exe应用程序 - Open .exe application from .NET console application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM