3

I have created a class and made it com visible:

[ComVisible(true)]
    [Guid("FD909333-3CD0-477F-8A7E-B8045B0B84EC")]
    [ClassInterface(ClassInterfaceType.None)]
    [ProgId("TestComApp.TestApp.TestClass")]
    public class TestClass:ITestCom
    {
        public int Add(int a, int b) { return a + b; }
    }

Also the interface is set to be COM visible:

[ComVisible(true)]
    [Guid("26567B41-15DB-4EE2-A277-357EAE96BF6A")]
    [InterfaceType(ComInterfaceType.InterfaceIsDual)]
    interface ITestCom
    {
         int Add(int a, int b);
    }

But when I am trying to register the DLL

regsvr32 /i TestComApp.dll

I am getting the following error "The module was loaded but the entry-point DLLRegisterServer was not found"

enter image description here

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
Simsons
  • 12,295
  • 42
  • 153
  • 269

1 Answers1

6

To register a .NET DLL, you need to use Regasm.exe instead of regsvr32.exe. Regasm.exe is located in C:\Windows\Microsoft.NET\Framework\v4.0.30319 (or similar depending on .NET version).

Also make sure to specify the /codebase option, or make the assembly strongly-named, otherwise COM won't be able to find the DLL.

user1610015
  • 6,561
  • 2
  • 15
  • 18