C# - 建立自訂Console參考檔(類似專案檔簡易管理)

C# - 建立自訂Console參考檔(類似專案檔簡易管理)

一般執行命令列編譯寫法:
csc /target:exe /reference:mscorlib.dll /out:HelloWorld.exe  HelloWorld.cs

而若參考檔很多,此寫法不是很適合。

因此現在我們使用延伸檔案方式來處理:

一、參考檔管理:
新增文字檔:helloworld.rsp,內容如下:
/target:exe
/referente:mscorlib.dll
/out:HelloWorld.exe

二、csc.exe命令列執行寫法:
csc @helloworld.rsp helloworld.cs

延伸閱讀:
Compiling C# code from the command line - LA.NET [EN]
http://msmvps.com/blogs/luisabreu/archive/2007/08/31/compiling-c-code-from-de-code-line.aspx