泪奔,跪求
////////Class1.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace names1 { public class Class1 { public int c1(int a, int b) { return a * b; } } }
/////////Default.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using names1; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Class1 myclass = new Class1(); Response.Write(myclass.c1(3,3).ToString()); } }
-----------------------------------
用csc把class1.cs编成class.dll后,在资源管理器右击网站名称添加引用:如下图,然后删除class1.cs文件,=>重新生成网站,=>发布网站。结果却引用不到编写的类
vs中点击绿箭头(运行)一切正常:
独立用地址打开则: