C# dll to use in classic ASP

倾然丶 夕夏残阳落幕 提交于 2019-12-11 09:09:38

问题


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


回答1:


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


来源:https://stackoverflow.com/questions/16895507/c-sharp-dll-to-use-in-classic-asp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!