IRegistrationServices.RegisterAssembly Method
Registers the classes in a managed assembly to enable creation from COM.
[Visual Basic] Function RegisterAssembly( _ ByVal assembly As Assembly, _ ByVal flags As AssemblyRegistrationFlags _ ) As Boolean [C#] bool RegisterAssembly( Assembly assembly, AssemblyRegistrationFlags flags ); [C++] bool RegisterAssembly( Assembly* assembly, AssemblyRegistrationFlags flags ); [JScript] function RegisterAssembly( assembly : Assembly, flags : AssemblyRegistrationFlags ) : Boolean;
Parameters
- assembly
- The assembly to be registered.
- flags
- An AssemblyRegistrationFlags value indicating any special settings needed when registering assembly.
Return Value
true if assembly contains types that were successfully registered; otherwise false if the assembly contains no eligible types.
Exceptions
| Exception Type | Condition |
|---|---|
| ArgumentNullException | assembly is a null reference (Nothing in Visual Basic). |
| InvalidOperationException | The full name of assembly is a null reference (Nothing in Visual Basic).
-or- A method marked with ComRegisterFunctionAttribute is not static (Shared in Visual Basic) . -or- There is more than one method marked with ComRegisterFunctionAttribute at a given level of the hierarchy. -or- The signature of the method marked with ComRegisterFunctionAttribute is not valid. |
Remarks
RegisterAssembly adds the appropriate registry entries for the types in the specified assembly. This method also calls any registration functions found in the assembly.
Use Assembly.Load to get an assembly.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also
IRegistrationServices Interface | IRegistrationServices Members | System.Runtime.InteropServices Namespace