为什么在编译.NET Core控制台应用程序时,我们同时出现dll和exe文件? [英] Why when compiling .NET Core console application we end up with both dll and exe files?

查看:125
本文介绍了为什么在编译.NET Core控制台应用程序时,我们同时出现dll和exe文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,在编译.NET Core控制台应用程序时,会在Windows上创建具有项目名称的dll和exe文件。这是为什么?在完整的.Net框架中,只会创建exe文件。

I have noticed that both dll and exe files with the name of the project are created on Windows when compiling a .NET Core console application. Why is that? In full .Net framework only the exe file would be created.

推荐答案

在.Net Core 3.0之前,只有 dll 已创建(尽管您仍然可以进行依赖于平台的单个文件构建)。在这些情况下,您必须使用命令 dotnet MyProject.dll 来启动程序。

Prior to .Net Core 3.0, only the dll was created (although you could still do a single file build that was platform-dependent). In these cases you had to use the command dotnet MyProject.dll to start your program.

.Net Core 3.0,他们添加了 exe ,它实际上仍然只是上述命令的包装。在其他操作系统上,它还会创建一个可执行文件,只是将其命名为 MyProject 而不是 MyProject.exe

With .Net Core 3.0, they added the exe, which is still really just a wrapper around the command above. On other operating systems it also creates an executable file, it just names it MyProject instead of MyProject.exe

如果人们有仍然可以执行dotnet命令的旧脚本,则此设置不会破坏它们,但是如果您只想使用 exe ,您也可以这样做。

If people have old scripts that still make the dotnet command, this setup doesn't break them, but if you want to just use an exe, you can do that too.

这篇关于为什么在编译.NET Core控制台应用程序时,我们同时出现dll和exe文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆