1

I have the following C# code

namespace testDll
{
    class testDLL
    {
        public int add(int val)
        {
            return val + 5;
        }
    }
}

Created dll using Visual Studio Express 2010 i.e going to projet properties, changing the output type to classlibrary and Make assembly COM visible. Everytime I try to register the dll using regsvr32.exe

I get error dllregisterserver entrypoint was not found

kirelagin
  • 13,248
  • 2
  • 42
  • 57
delwasaf ewrew
  • 557
  • 1
  • 8
  • 21
  • Post all relevant code in question. Of course your C# code is missing some require elements to make it even possible to make it a COM library. – Security Hound Jun 03 '13 at 11:22
  • 1
    See http://stackoverflow.com/questions/4198583/how-do-i-register-a-com-dll-written-in-c-sharp-with-regsvr32 – jfrankcarr Jun 03 '13 at 11:35
  • thats the complete class.I though visual studio will automatically convert to dll by selecting "class library". Please point me to the right direction, what am i missing – delwasaf ewrew Jun 03 '13 at 11:42
  • @delwasafewrew - a class library project does compile to a "dll", but it's not a regular COM dll. – Hans Kesting Jun 04 '13 at 11:01

1 Answers1

3

you cannot Register a .net dll with regsvr32.exe. you have to use regasm.exe. look here for a description

generally you just use

regasm.exe NameOfDotNetDLL.dll /codebase

furthermore you have to add the ComVisible attribute to your class and every method you want to have comvisible like so

[ComVisibleAttribute( true )]
ulluoink
  • 2,775
  • 2
  • 17
  • 22