Author Topic: How to access COM componets in C#?  (Read 1094 times)


  • Newbie
  • *
  • Posts: 3
How to access COM componets in C#?
« on: June 13, 2011, 12:40:55 am »
I have a visual c++ com server component. I want to use it in C#. Is it possible to use it? If so, how? Can any one help me on this?

- thanks
« Last Edit: June 13, 2011, 06:09:30 pm by kathir »


  • Administrator
  • Sr. Member
  • *****
  • Posts: 283
Re: How to access COM componets in C#?
« Reply #1 on: June 13, 2011, 05:47:42 pm »
Note that SFTComServer is the name of your COM server component.

There are couple of steps before you use the COM DLL into your C# application:

1.   Create a strong name file as shown below:
      C:\kathir\SFTComServer>sn -k key.snk

2.   Create the DLL that is compatible with C# using tlbimp
      C:\kathir\SFTComServer>tlbimp release\SFTComServer.tlb /keyf
      ile:key.snk /out:SFTComServer_vsnet.dll /namespace:SFTCOMServer

      Microsoft (R) .NET Framework Type Library to Assembly Converter          2.0.50727.42
      Copyright (C) Microsoft Corporation.  All rights reserved.

      Type library imported to C:\kathir\SFTComServer\SFTComServer

3.   Register the newly created .DLL

      C:\kathir\SFTComServer>regasm SFTComServer_vsnet.dll
      Microsoft (R) .NET Framework Assembly Registration Utility             2.0.50727.3053
      Copyright (C) Microsoft Corporation 1998-2004.  All rights reserved.

      Types registered successfully

4.   Register the COM DLL if you have not done so far.

Now is the time to write C# test application by adding a reference to the newly created SFTComServer_vsnet.dll.


  • Administrator
  • Full Member
  • *****
  • Posts: 69
Re: How to access COM componets in C#?
« Reply #2 on: November 01, 2011, 10:55:14 am »


Disclaimer: This web site is for educational and informational purposes only. Click here to read the Disclaimer.
Content copyright 2010-2014. Kathiresan. All rights reserved.
This page is using SMF version 2.0.1