所以这个东西其实并不实用,因为有.net环境的话就完全可以选择asp.net了.
1.打开VS.Net.新建一个项目,模板选择类库.我这里使用的是C#
![attachments/month_0506/he8l_ar0401.gif](http://blog.tao123.com/attachments/month_0506/he8l_ar0401.gif)
2.将自动生成的class1.cs改成test.cs.并修改相应的代码.这里我们只是先做一个测试.
![attachments/month_0506/63u9_a0402.gif](http://blog.tao123.com/attachments/month_0506/63u9_a0402.gif)
3.写一个很简单的函数,返回一段字符串.
全部代码如下:
using System;
namespace Allinhands
{
/// <summary>
/// Class1 的摘要说明。
/// </summary>
public class Test
{
public string GetTestString()
{
return "This is My Test String.";
}
}
}
![attachments/month_0506/b91e_ar0403.gif](http://blog.tao123.com/attachments/month_0506/b91e_ar0403.gif)
4.比较重要的一步.
打开项目属性,在"配置属性"->"生成"中,把"为 COM Interop注册"改成"True"
![attachments/month_0506/vsky_ar0404.gif](http://blog.tao123.com/attachments/month_0506/vsky_ar0404.gif)
5.生成项目.
新建一个asp文件.
<%
set qq=server.CreateObject("Allinhands.test")
Response.write qq.GetTestString()
set qq=nothing
%>
其中"Allinhands"为你项目的名称,test为类的名称.
打开,结果输出"This is My Test String."
在此基础上,我们可以制作其他比较复杂的组件,只要你想的到