免費開源的 C# 編譯器:CSharpCompiler

jopen 9年前發布 | 24K 次閱讀 .NET開發 CSharpCompiler

CSharpCompiler 是免費開源的 C# 編譯器,可編譯 C# 源代碼。

Key Features and Reasons Why

- Complies single and multiple source files.

- Stores compiler errors and warnings in an array of string. So it is easy to use.

- Totally light weight ( 4kb) and not dependent on any third-party libraries or API. Only pure .Net framework!

免費開源的 C# 編譯器:CSharpCompiler

示例

CSharpCompiler compiler = new CSharpCompiler (); 
compiler.SourceCode = richTextBox1.Text;
compiler.Output = CSharpCompiler.OutputType.EXE; 
compiler.Path = "C:\\Users\\Danny\\Desktop"; 
compiler.NameOfAssembly = "Hello World!"; 
compiler.CompileCode();if (compiler.SuccessfullCompilation == false ) 
{ 
if (compiler.CompilerErrors != null ) 
listBox1.Items.AddRange(compiler.CompilerErrors); 
if (compiler.CompilerWarnings != null ) 
listBox1.Items.AddRange(compiler.CompilerWarnings);

}

項目主頁:http://www.baiduhome.net/lib/view/home/1435843572388

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!