RegistrationServices.RegisterAssembly 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將類別登錄在受管理的組合語言中,以便從 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所用特殊設定的值。
傳回
true 如果 assembly 包含成功註冊的型別;否則 false 若組合中沒有合格型別。
實作
- 屬性
例外狀況
assembly 是 null。
的 assembly 全名為 null。
-或-
標記為 ComRegisterFunctionAttribute 的方法不是 static。
-或-
在給定階層的某一層級,有不只一種標記為 的方法 ComRegisterFunctionAttribute 。
-或-
標記為 的方法 ComRegisterFunctionAttribute 簽名無效。
一個由使用者自訂的註冊函式(以屬性標記) ComRegisterFunctionAttribute 會拋出例外。
備註
RegisterAssembly 為指定組件中類型的適當登錄項目加入。 此方法同時呼叫組裝中的任何配準函數。
用 Assembly.Load 來裝組裝。