c# – 启动时控制台应用程序和.NET中的Windows应用程序有什么区别

想象一下.NET应用程序在构建之后启动,无论是Console还是WinForm.除了像/ subsystem,/ out之类的complie-time标志,…操作系统(当前是
Windows)或.NET虚拟机(我不知道哪个碰巧正在运行的应用程序,首先是如何)决定哪一个要运行所需的系统,要运行的窗口系统是什么? 最佳答案 我看到问题已经更新以反映FrédéricHamidi的这个评论解决方案,但是为了遵守Stack Overflow的Q& A格式,我承认这是社区Wiki标志集的答案,按照“
Question with no answers, but issue solved in the comments (or extended in chat)”.

There is a flag. In the executable file itself, somewhere in the PE header. That flag is set at build time and indicates the subsystem the application wants to run under (GUI or console). The loader reads that flag and sets up a console accordingly. This predates .NET — the CLR does not bring anything new to the picture here.

点赞