C# – Unable to register DLL using Regsv32 – error “Dll was loaded but the entry-point DllRegisterServer was not found”

cregsvr32

I have written my own class library using C# 3.5. For using this dll in classic ASP application, I am trying to register this dll in Registry using regsvr32 command. But I am getting typical error like "The module "TestDll.dll" was loaded but the entry-point DllRegisterServer was not found.Make sure that "TestDll.dll" is a valid DLL or OCX file and then try again**."

I found other option to include switch /tlb in regsvr32 command, by its this going ahead. But I am sure if really my dll is getting registered or not ?

Could you please let me know what am I missing here ? Its very urgent.

(Note :- I have OS windows 7 on my machine. Does it make difference ?)
Quickest response will be really appreciated.

Regards
Sarang

Best Answer

You are attempting to register a dll that is not a COM library. Pre .NET com dlls need to export a set of functions and interface implementations that support things like self registration (in your case) and class factory things. These standardized exports were essentially the hooks by which the com implementation in windows was/is able to interact with a DLL via com conventions.

For .NET, these exports, and the tools that need them like regsvr32, do not apply directly to the assemblies we create, even if they are set up for com interop.

Registration and type initialization is handled quite differently for .net interop. Registration for instance is handled by a tool called regasm.

Do some research on com callable wrappers .net/com interop. http://msdn.microsoft.com/en-us/library/bd9cdfyx.aspx