Skip to content

Why does System.Reflection.Assembly.GetEntryAssembly().Location returns .dll instead of .exe? #61000

Answered by vitek-karas
tommyvct asked this question in Q&A
Discussion options

You must be logged in to vote

The .dll is a managed assembly (same format as with .NET Framework), it's an intermediate language code, not directly executable by the OS. The .exe is a small shim, which knows how to find the .NET runtime, loads it, and tells it to run the code in the .dll. The .exe is a directly executable code.

.NET Framework's .exe was also a managed assembly with no directly executable code, but since .NET Framework is part of the OS, the OS knows that these are "managed executables" and handles the "shim" part in the OS loader directly (find the runtime, load it, ask it to execute the managed code). Starting with .NET Core (and later on with .NET) this approach was abandoned, as it can really only …

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@tommyvct
Comment options

Answer selected by huoyaoyuan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants