none
.Net C# COM server implementation RRS feed

  • Question

  • I have to make a COM (yes, it's a must) and want to write it using C# and .net

    My first problem is how to implement a certain category (e.g. so it is listed in a certain Component Category by OLEVIEW) ?

    Anything special to consider for making this an console app (later on as a windows service, but not for now if possible) ?

    Monday, June 19, 2017 10:29 AM

All replies

  • COM and .Net are inherently different. The Type systems used, object lifetime management etc are completely different in both.

    However if you want to create a COM server and have the .Net clients to interact with them, you can use the .Net COM interoperability to achieve the same. There are a lot of documentation available for the same. Some of them are the following 

    https://msdn.microsoft.com/en-us/library/ms973800.aspx

    https://msdn.microsoft.com/en-us/library/office/bb610378.aspx

    Monday, June 19, 2017 11:43 AM
  • Thanks,

    I know about the principal differences, however I know it is possible to implement a COM server (I think both in-process and out-of-process) by C#/.Net and access it by e.g. C++ client (https://msdn.microsoft.com/en-us/library/aa645738%28v=vs.71%29.aspx?f=255&MSPPError=-2147217396 clearly shows this, at least for a C# in-process server).

    I even got it visible from e.g. VBA now (so far just as a in-process server), but I still don't know how to specify the Implemented Categories registry item by project config (vs) or by code in the project itself.

    I have a feeling that the RegistrationServices is there for this purpose, but I do not understand exactly how to use the service it self and more specific how to tell it to add the necessary registry items for exposing the COM object as implementing a certain category (which is mandatory in my case)

    Tuesday, June 20, 2017 10:50 AM
  • Hi EuroEager,

    >>but I still don't know how to specify the Implemented Categories registry item by project config (vs) or by code in the project itself.

    Based on your description, it seems that you want to implemented Categories registry item via c#. I am sure what is the Categories registry item, could you please describe it in detailed.

    >>I have a feeling that the RegistrationServices is there for this purpose, but I do not understand exactly how to use the service it self and more specific how to tell it to add the necessary registry items for exposing the COM object as implementing a certain category

    about RegistrationServices, the following thread provide a sample for your reference. Please check Rhys's reply.

    https://stackoverflow.com/questions/446417/create-out-of-process-com-in-c-net

    Best regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, July 5, 2017 7:58 AM
    Moderator