How to run COM server DLL as a surrogate process for integrating IM application with Office?

Manoj 86 Reputation points
2022-01-05T10:31:08.02+00:00

Hii, I am a beginner in Windows and Dotnet development and I am trying to integrate an IM client application with Office 2019.

I have made a COM server using .NET6.0 framework. I followed this documentation and the given sample as a reference to create and expose the COM server. I can see in the Registry that the class which has the attribute [ComVisible(true)] is registered. There are two entries in the registry:

1) Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ClassLibrary1.MyIMClient : which has the subkey "CLSID" and the corresponding class ID as its value.
2) Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{6E5C29C0-1196-4D6D-BC8E-BDA1604A4BF3} : which has the default value "CoreCLR COMHost Server" and two subkeys -

  • InProcServer32: which contains the path of the .comhost.dll file
  • ProgID: which contains the name of the class ClassLibrary1.MyIMClient

According to the official documentation, to discover the IM client application, Office looks for specific keys and entries in the Registry one of which is the ProcessName and if I see the existing keys which are being used for "Lync", they also contain ProcessId.

But my COM server is not running as a process, it is just a DLL file that was built from Visual Studio. So I read about this doc and followed the steps to use an "AppID" for the class. For now, I have taken the same AppID as the CLSID and I've left the DllSurrogate value as empty to use the system supplied surrogate. After all this, the COM server DLL is not running as a surrogate process. Can anyone please help me figure this out?

Thanks!
Manoj

Developer technologies C#
{count} votes

Accepted answer
  1. RLWA32 49,536 Reputation points
    2022-01-06T12:41:53.193+00:00

    As I demonstrated in my earlier comment a properly configured .NET COM Server can be hosted in a surrogate process.

    In addition to creating the necessary registry entries under AppID and CLSID you also need to create the registry entries needed for marshaling. This can be accomplished by registering a type library for you server.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.