src/Microsoft/Windows/ComponentObjectModel/_Library/ComponentRegistrationManager.cs
/// <summary>
/// Registers a COM component, implemented with .NET Core.
/// </summary>
/// <param name="dotNetCoreComponentRegistrationInformation">The COM component information.</param>
/// <param name="scope">The registration scope.</param>
Registers a COM component, implemented with .NET Core.
Registers a COM component implemented with . NET Core .
public void Register( DotNetCoreComponentRegistrationInformation dotNetCoreComponentRegistrationInformation, ComponentRegistrationScope scope ) {
            RegistryHive hive = GetHiveForScopeOrThrow( scope );
            using( IRegistryKey hiveKey = _registry.OpenBaseKey( hive, RegistryView.Default ) ) {
                using( IRegistryKey classesClsidKey = hiveKey.OpenSubKey( @"Software\Classes\CLSID\", true ) ) {
                    using( IRegistryKey clsidKey = classesClsidKey.CreateSubKey( Utils.GuidToClsid( dotNetCoreComponentRegistrationInformation.CLSID ), true ) ) {
                        using( IRegistryKey serverKey = clsidKey.CreateSubKey( dotNetCoreComponentRegistrationInformation.ServerType.ToString(), true ) ) {
                            switch( dotNetCoreComponentRegistrationInformation.ServerType ) {
                                case ComponentServerType.InprocServer32: {
                                        serverKey.SetValue( "ThreadingModel", dotNetCoreComponentRegistrationInformation.ThreadingModel.ToString(), RegistryValueKind.String );
                                        serverKey.SetValue( "", dotNetCoreComponentRegistrationInformation.ComHost );
                                        break;
                                    }
                                case ComponentServerType.InprocServer:
                                case ComponentServerType.LocalServer:
                                case ComponentServerType.LocalServer32: {
                                        throw new NotImplementedException();
                                    }
                                default: {
                                        throw new ArgumentException();
                                    }
                            }
                        }
                    }
                }
            }
        }
public void Register ( DotNetCoreComponentRegistrationInformation dotNetCoreComponentRegistrationInformation , ComponentRegistrationScope scope ) { RegistryHive hive = GetHiveForScopeOrThrow ( scope ) ; using ( IRegistryKey hiveKey = _registry . OpenBaseKey ( hive , RegistryView . Default ) ) { using ( IRegistryKey classesClsidKey = hiveKey . OpenSubKey ( @"Software\Classes\CLSID\" , true ) ) { using ( IRegistryKey clsidKey = classesClsidKey . CreateSubKey ( Utils . GuidToClsid ( dotNetCoreComponentRegistrationInformation . CLSID ) , true ) ) { using ( IRegistryKey serverKey = clsidKey . CreateSubKey ( dotNetCoreComponentRegistrationInformation . ServerType . ToString ( ) , true ) ) { switch ( dotNetCoreComponentRegistrationInformation . ServerType ) { case ComponentServerType . InprocServer32 : { serverKey . SetValue ( " " , dotNetCoreComponentRegistrationInformation . ThreadingModel . ToString ( ) , RegistryValueKind . String ) ; serverKey . SetValue ( " " , dotNetCoreComponentRegistrationInformation . ComHost ) ; break ; } case ComponentServerType . InprocServer : case ComponentServerType . LocalServer : case ComponentServerType . LocalServer32 : { throw new NotImplementedException ( ) ; } default : { throw new ArgumentException ( ) ; } } } } } } }
Registers a COM component, implemented with .NET Core.
Registers a COM component implemented with . NET Core .
dotNetCoreComponentRegistrationInformation
DotNetCoreComponentRegistrationInformation
The COM component information.
The COM component information .
scope
ComponentRegistrationScope
The registration scope.
The registration scope .