This project is an example on how to manually consume a COM server from C# or a C# server from COM client. It also contains projects for less common scenarios involving .NET and COM.
Running COM server with Net client example:
- Load
ComInterop.slnin Visual Studio - Build desired solution configuration (e.g.
Debug|x86) - Register the COM server (i.e.
ComServer.dll) usingregsvr32.exefrom an elevated command promptregsvr32.exe ComServer.dll
- Set the
NetClientproject as the StartUp project - Press "F5" from within Visual Studio to debug
When done with the project, remember to unregister the COM server with regsvr32.exe passing the /u flag (e.g. regsvr32.exe /u ComServer.dll).
Running Net server with COM client example:
- Load
ComInterop.slnin Visual Studio - Build desired solution configuration (e.g.
Debug|x86) - Register the Net server (i.e.
NetServer.dll) usingregasm.exefrom an elevated command promptregasm.exe NetServer.dll /codebase- The
/codebaseflag adds the current path of the assembly to the registry
- Set the
ComClientproject as the StartUp project - Press "F5" from within Visual Studio to debug
When done with the project, remember to unregister the Net server with regasm.exe passing the /u flag (e.g. regsvr32.exe /u NetServer.dll).
Projects demonstrating Registration Free (RegFree) COM are also included.
Running the RegFree COM server with Net client example:
- Load
ComInterop.slnin Visual Studio - Build desired solution configuration (e.g.
Debug|x86)- The current solution only supports the "F5" experience for the
AnyCPUandx86platforms in RegFree COM.
- The current solution only supports the "F5" experience for the
- Set the
NetClient_RegFreeproject as the StartUp project - Press "F5" from within Visual Studio to debug
Running the RegFree Net server with COM client example:
- Load
ComInterop.slnin Visual Studio - Build desired solution configuration (e.g.
Debug|x86) - Set the
ComClient_RegFreeproject as the StartUp project - Press "F5" from within Visual Studio to debug
Running the Out-of-proc demo:
- Load the
ComInterop.slnin Visual Studio - Build desired solution configuration (e.g.
Debug|x86) - Set the
OutOfProcDemoproject as the StartUp project - Press "F5" from within Visual Studio to debug
Note The Out-of-proc demo launches a child process from the main process.