RegistrationServices.RegisterAssembly 方法

定義

註冊 Managed 組件中的類別,以啟用從 COM 的建立。

public:
 virtual bool RegisterAssembly(System::Reflection::Assembly ^ assembly, System::Runtime::InteropServices::AssemblyRegistrationFlags flags);
public virtual bool RegisterAssembly (System.Reflection.Assembly assembly, System.Runtime.InteropServices.AssemblyRegistrationFlags flags);
[System.Security.SecurityCritical]
public virtual bool RegisterAssembly (System.Reflection.Assembly assembly, System.Runtime.InteropServices.AssemblyRegistrationFlags flags);
abstract member RegisterAssembly : System.Reflection.Assembly * System.Runtime.InteropServices.AssemblyRegistrationFlags -> bool
override this.RegisterAssembly : System.Reflection.Assembly * System.Runtime.InteropServices.AssemblyRegistrationFlags -> bool
[<System.Security.SecurityCritical>]
abstract member RegisterAssembly : System.Reflection.Assembly * System.Runtime.InteropServices.AssemblyRegistrationFlags -> bool
override this.RegisterAssembly : System.Reflection.Assembly * System.Runtime.InteropServices.AssemblyRegistrationFlags -> bool
Public Overridable Function RegisterAssembly (assembly As Assembly, flags As AssemblyRegistrationFlags) As Boolean

參數

assembly
Assembly

要登錄的組件。

flags
AssemblyRegistrationFlags

AssemblyRegistrationFlags 值,指出在登錄 assembly 時所使用的任何特殊設定。

傳回

Boolean

如果 assembly 含有成功登錄的型別,則為 true,否則為 false (如果組件沒有包含合適的型別)。

實作

屬性

例外狀況

assemblynull

assembly 的完整名稱是 null

-或- 以 ComRegisterFunctionAttribute 標記的方法不是 static

-或- 在階層架構的指定層級中,有一個以上的方法是以 ComRegisterFunctionAttribute 標記。

-或- 以 ComRegisterFunctionAttribute 標記之方法的簽章無效。

使用者定義的自訂註冊函式 (使用 ComRegisterFunctionAttribute 屬性標記) 擲回例外狀況。

備註

RegisterAssembly 針對指定元件中的類型加入適當的登錄專案。 這個方法也會呼叫在元件中找到的任何註冊函式。

使用 Assembly.Load 取得元件。

適用於