Edit

Share via


Assembly.GetEntryAssembly Method

Definition

Gets the entry assembly for the running application.

public:
 static System::Reflection::Assembly ^ GetEntryAssembly();
public static System.Reflection.Assembly? GetEntryAssembly ();
public static System.Reflection.Assembly GetEntryAssembly ();
static member GetEntryAssembly : unit -> System.Reflection.Assembly
Public Shared Function GetEntryAssembly () As Assembly

Returns

The entry assembly for the running application. Can return null when called from unmanaged code.

Remarks

.NET Framework only: In the default application domain, this method returns the process executable. In other application domains, this method returns the first executable that was executed by ExecuteAssembly.

The GetEntryAssembly method can return null when a managed assembly has been loaded from an unmanaged application. For example, if an unmanaged application creates an instance of a COM component written in C#, a call to the GetEntryAssembly method from the C# component returns null, because the entry point for the process was unmanaged code rather than a managed assembly.

Applies to