C#DLL在传统的ASP使用 [英] C# dll to use in classic ASP

查看:108
本文介绍了C#DLL在传统的ASP使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有下面的C#code

I have the following C# code

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

使用Visual Studio防爆preSS 2010即要谟性质,改变输出类型classlibrary做优做强装配COM可见创建DLL。
每次我尝试使用Regsvr32.exe注册DLL

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

我得到错误中的DllRegisterServer入口点未找到

推荐答案

你不能注册用regsvr32.exe的一个.NET的DLL。你必须使用regasm.exe。看这里说明

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

通常你只需要使用

regasm.exe NameOfDotNetDLL.dll /codebase

此外,您必须将标记有ComVisible特性属性添加到您的类和你想拥有像标记有ComVisible特性所以每一个方法

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

[ComVisibleAttribute( true )]

这篇关于C#DLL在传统的ASP使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆