-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Description
As far as I know, currently, to register a COM object written in .NET 5 (or .NET Core 3.x for that matter) we need to
"Open an elevated command prompt and run regsvr32 ProjectName.comhost.dll. That will register all of your exposed .NET objects with COM." from here
I think the relevant source is here: https://github.com/dotnet/runtime/blob/master/src/installer/corehost/cli/comhost/comhost.cpp#L309 it seems pretty much hardcoded for HKEY_LOCAL_MACHINE.
As you know, registering COM component in HKCU (HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID for the CLSID, etc.) is pretty common and supported by "COM" in general (CoCreateInstance, etc.). It's also supported by tooling such as Visual Studio's ATL and Windows' regsvr32.exe with the help of DllInstall (optional) DLL export:
https://docs.microsoft.com/en-us/windows/win32/api/shlwapi/nf-shlwapi-dllinstall
It has the enormous advantage of avoiding elevated rights for setup, installers, etc.
Can support for this be added to comhost?
In the meantime, is there any way to do this with current .NET 5? Should I write a custom comhost? How?
Metadata
Metadata
Assignees
Labels
Type
Projects
Status