delwasaf ewrew delwasaf ewrew - 7 days ago 5
C# Question

C# dll to use in classic ASP

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

Answer

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 )]