AssemblyBuilder.SetEntryPoint Method

Definition

Sets the entry point for this dynamic assembly.

Overloads

SetEntryPoint(MethodInfo)

Sets the entry point for this dynamic assembly, assuming that a console application is being built.

SetEntryPoint(MethodInfo, PEFileKinds)

Sets the entry point for this assembly and defines the type of the portable executable (PE file) being built.

SetEntryPoint(MethodInfo)

Sets the entry point for this dynamic assembly, assuming that a console application is being built.

C#
public void SetEntryPoint (System.Reflection.MethodInfo entryMethod);

Parameters

entryMethod
MethodInfo

A reference to the method that represents the entry point for this dynamic assembly.

Exceptions

entryMethod is null.

entryMethod is not contained within this assembly.

The caller does not have the required permission.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

SetEntryPoint(MethodInfo, PEFileKinds)

Sets the entry point for this assembly and defines the type of the portable executable (PE file) being built.

C#
public void SetEntryPoint (System.Reflection.MethodInfo entryMethod, System.Reflection.Emit.PEFileKinds fileKind);

Parameters

entryMethod
MethodInfo

A reference to the method that represents the entry point for this dynamic assembly.

fileKind
PEFileKinds

The type of the assembly executable being built.

Exceptions

entryMethod is null.

entryMethod is not contained within this assembly.

The caller does not have the required permission.

Remarks

Note

Starting with the .NET Framework 2.0 Service Pack 1, this member no longer requires ReflectionPermission with the ReflectionPermissionFlag.ReflectionEmit flag. (See Security Issues in Reflection Emit.) To use this functionality, your application should target the .NET Framework 3.5 or later.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1