不包含适合于入口点的静态“Main”方法 csc编译异常
不包含适合于入口点的静态“Main”方法 csc编译错误
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class hdwdgx : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string strConnection = "user id=sa;password=ccccc;";
strConnection += "Initial Catalog=kkkkk;Data Source=HCWBU;";
strConnection +="connect timeout=30;";
string strSql = "insert into dnt_words (admin,find,replacement) values(256,'kknd','wto','kwwl')";
SqlConnection conn = new SqlConnection(strConnection );
try
{
conn.Open();
SqlCommand comm = new SqlCommand(strSql ,conn );
int rowsReturn = comm.ExecuteNonQuery();
Response.Write("--------OK-----------");
}
catch
{
Response.Write("---------NO-------------");
}
}
}
//csc /out:c:\bbb.dll bbb.aspx.cs
//csc编译错误提示:
//error CS5001: 程序“c:\bbb.dll”不包含适合于入口点的静态“Main”方法
//怎么解决?
------解决思路----------------------
新创建的项目么,项目类型有没有选对?
在项目属性中项目类型怎么设置的?
------解决思路----------------------
少了主程序min(), 一般在文件program.cs中
------解决思路----------------------
呃,更正:main()
------解决思路----------------------
你脱离了框架 直接编译这段代码 当然报错 入口函数在asp.net框架中难道你认为这段代码可以单独运行么?
------解决思路----------------------
难怪,你的编译参数写得不对,估计你指定了entrypoint参数,但是dll是不需要的。
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class hdwdgx : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string strConnection = "user id=sa;password=ccccc;";
strConnection += "Initial Catalog=kkkkk;Data Source=HCWBU;";
strConnection +="connect timeout=30;";
string strSql = "insert into dnt_words (admin,find,replacement) values(256,'kknd','wto','kwwl')";
SqlConnection conn = new SqlConnection(strConnection );
try
{
conn.Open();
SqlCommand comm = new SqlCommand(strSql ,conn );
int rowsReturn = comm.ExecuteNonQuery();
Response.Write("--------OK-----------");
}
catch
{
Response.Write("---------NO-------------");
}
}
}
//csc /out:c:\bbb.dll bbb.aspx.cs
//csc编译错误提示:
//error CS5001: 程序“c:\bbb.dll”不包含适合于入口点的静态“Main”方法
//怎么解决?
------解决思路----------------------
新创建的项目么,项目类型有没有选对?
在项目属性中项目类型怎么设置的?
------解决思路----------------------
少了主程序min(), 一般在文件program.cs中
------解决思路----------------------
呃,更正:main()
------解决思路----------------------
你脱离了框架 直接编译这段代码 当然报错 入口函数在asp.net框架中难道你认为这段代码可以单独运行么?
------解决思路----------------------
难怪,你的编译参数写得不对,估计你指定了entrypoint参数,但是dll是不需要的。