Step 1: Create a Runtime-Callable-Wrapper.
There are two ways
Method 1: using TlbImp to Generate RCW
tlbimp <YourCOMSvr>.tlb /out:<YourCOMSvr>.dll
using this way is using the default .NET-Interop Marshalling, sometimes (Meaning when it does not work) you need to change the marshalling by perform the additional steps
ildasm <YourCOMSvr>.dll /out:<YourCOMSvr>.il
//Modify <YourCOMSvr>.il
ilasm <YourCOMSvr>.il /dll
Method 2: Manually create a C++/Cli project serves as a wrapper for the COM server
Step 2: C# Code
Reference the RCW and use the following code to connect to the COM Server
Type yourComType= Type.GetTypeFromProgID(yourComSvrProgID, serverPcName);
var oInterface = (IYourCOMInterface)Activator.CreateInstance(yourComType);
//Then start using oInterface