Yes, and if you need to reference a .Net Framework class,
add /r: classname.dll /r:anotherclassname.dll to the command :
csc.exe /t:library /r:system.dll /r:system.web.dll /out:cb.dll cb.cs
I shortened the filename and dll name to fit the command in one line.
Substitute your own names, of course.
If you want a number of files compiled into a single assembly, just put
all your .cs files into a directory and use a wildcard in the command :
csc.exe /t:library /r:system.dll /r:system.web.dll /out:cb.dll *.cs
Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================
"SAI" <te**@test.com> wrote in message news:uP**************@TK2MSFTNGP12.phx.gbl...
I use following method to compile. Is it right? thanks.
csc.exe /out:mycodebehind.dll /t:library mycodebehind.cs
"Juan T. Llibre" <no***********@nowhere.com>
¼¶¼g©ó¶l¥ó·s»D:%2***************@TK2MSFTNGP10.phx. gbl... You must compile the code-behind before attempting to inherit.
Also, if you're inheriting from page, the format is as follows :
<%@ Import Namespace="MyNameSpace" %>
<%@ Page language="C#" Inherits="MyNameSpace.MyClass" %>
For you, that translates into :
<%@ Import Namespace="MyStuff" %>
<%@ Page language="C#" Inherits="MyStuff.MyClass" %>
Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================
"SAI" <te**@test.com> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl...I have 2 files which are copied from Microsoft for testing code behind.
But always show error "Parser Error Message: Could not load type 'MyClass'."
and highlight the aspx file code, Is my server has problem? thx.
Line 1: <%@ Page Language="C#" Inherits="MyClass" %>
aspx file content :
<%@ Page Language="C#" Inherits="MyClass" %>
<html>
<head>
</head>
<body>
<form id="MyForm" runat="server">
<asp:textbox id="MyTextBox" runat="server" text="Hello World"></asp:textbox>
<asp:button id="MyButton" onclick="MyButton_Click" runat="server" text="Echo
Input"></asp:button>
<asp:Label id="MyLabel" runat="server"></asp:Label>
</form>
</body>
</html>
cs file content :
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace MyStuff
{
public class MyClass : Page
{
protected System.Web.UI.WebControls.Label MyLabel;
protected System.Web.UI.WebControls.Button MyButton;
protected System.Web.UI.WebControls.TextBox MyTextBox;
public void MyButton_Click(Object sender, EventArgs e)
{
MyLabel.Text = MyTextBox.Text.ToString();
}
}
}