Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why dotNET is creating a DLL for WinForms?

I’m migrating from .NET Framework to .NET (Core).

I’ve just realized that .NET Core applications created by VS2022 always have a DLL:

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

And if I examine my EXE’s details:

enter image description here

Why is the original filename set to the DLL? Can I change it to WinFormsApp2.exe?

With .NET Framework, no DLL was generated, and original filename was always set to the current EXE file. Can I reach this with .NET (Core) too?

>Solution :

In .NET Core, the assembly containing the entry point of your application (i.e., the "main" function) is compiled into a DLL, rather than an EXE like in .NET Framework. This is because .NET Core allows for more flexibility in terms of deployment options, such as running your application as a self-contained executable or as a runtime-dependent executable.

When you build your .NET Core application, the DLL containing the entry point is named after the project and will be the one that the runtime will look for when you run the executable. The executable that you see in the output directory is actually a small wrapper that includes the runtime and the DLL containing the application’s entry point.

It is not possible to change the name of the DLL to match the name of the EXE as it is hard-coded in the runtime. The original filename (in the File Properties) will always reflect the name of the DLL.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading