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 获取程序集。