Reference COM in C# project without registry VS Registration-Free COM RRS feed

  • Question

  • Hi Guys,

    Anyone know how to combine the following features in C# project?

    - Reference COM in C# project without registry

    - Registration-Free COM (use COM module at run-time without registry access)

    I have a C# project and COM (in C++) project.

    - In C# project, it refers the Interop module of COM instead of the COM directly. (So the C# project can be compiled without COM registered on build machine. Interop module is generated by tlbimp.exe)

    - At run-time, the COM objects should be created without the registry. (This can be implemented with

    Registration-Free COM

    But I found an additional issue. According to the 'Registration-Free COM' tech, it has to refer the COM directly in the C# project. It does not work if referring the Interop module of COM.

    So anyone has comment on this issue? Is that possible to combine these two features?




    Friday, April 22, 2011 8:54 AM

All replies


    Hi Shunchen,


    Welcome to the MSDN forum!

    You can P/Invoke unmanaged C++ dll from C# project.

    Please refer to this tutorial. This tutorial shows you what you need to do to be able to call unmanaged DLL functions from C#. The attributes discussed in the tutorial allow you to call these functions and have data types be marshaled correctly.


    Have a nice day!

    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, April 26, 2011 10:46 AM
  • I believe that you can refer to the COM component using reflection API's Type.GetProgId(), Type.GetClsId(). I am not sure. But these calls might be looking in to the registry.
    - Rajesh K
    Wednesday, April 27, 2011 10:12 AM