RegistrationServices.RegisterAssembly 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
註冊 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
要登錄的組件。
AssemblyRegistrationFlags 值,指出在登錄 assembly
時所使用的任何特殊設定。
傳回
如果 assembly
含有成功登錄的型別,則為 true
,否則為 false
(如果組件沒有包含合適的型別)。
實作
- 屬性
例外狀況
assembly
為 null
。
assembly
的完整名稱是 null
。
-或-
以 ComRegisterFunctionAttribute 標記的方法不是 static
。
-或-
在階層架構的指定層級中,有一個以上的方法是以 ComRegisterFunctionAttribute 標記。
-或-
以 ComRegisterFunctionAttribute 標記之方法的簽章無效。
使用者定義的自訂註冊函式 (使用 ComRegisterFunctionAttribute 屬性標記) 擲回例外狀況。
備註
RegisterAssembly
為指定元件中的型別加入適當的登錄專案。 這個方法也會呼叫元件中找到的任何註冊函式。
用來 Assembly.Load 取得元件。