1、寫好代碼先,編譯成DLL文件,用C#寫的CS文件需要用Framework中的CSC命令編譯,編譯步驟爲:
2、在命令工具中輸入 csc /t:library /r:System.Web.dll /r:System.dll /out: 目標文件名 源路徑/源文件名。
csc /target:library /out:e:/cyc/asp.net/words/database.dll e:/cyc/asp.net/words/aspnet2.0news/app_code/componenets/databse.cs
3、爲避免每次編譯的麻煩,可以建立cmd文件如csd_dl.cmd ,代碼如下:
cd/
d:
cd D:/sys03/microsoft.net/framework/v1.4322
csc /t:library /r:System.Web.dll /r:System.dll /out:E:/web/bin/WebTools.dll e:/web/bin/DbLink.cs
cmd
- 輸出文件 -
/out:<file> 輸出文件名(默認值: 包含主類的文件或第一個文件的基名稱)
/target:exe 生成控制檯可執行文件(默認) (縮寫: /t:exe)
/target:winexe 生成 Windows 可執行文件 (縮寫: /t:winexe)
/target:library 生成庫 (縮寫: /t:library)
/target:module 生成能添加到其他程序集的模塊 (縮寫: /t:module)
/define:<symbol list> 定義條件編譯符號 (縮寫: /d)
/doc:<file> 要生成的 XML 文檔文件
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1525150