Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically call C# Compiler to Compile C# code

I have designed my very own language that I, in the end, translate to C# code. Now I want to compile this C# code using the C# compiler through my Windows Forms Application.

Where is the actual compiler file located and how do I compile my code (currently placed in a string)??

like image 698
atastrophic Avatar asked Jun 03 '26 13:06

atastrophic


2 Answers

It sounds like you are looking for the CSharpCodeProvider. http://support.microsoft.com/kb/304655, or MSDN have examples.

like image 129
Marc Gravell Avatar answered Jun 06 '26 02:06

Marc Gravell


You can use C# CodeDom for this purpose. This link may help you

http://www.codeproject.com/Articles/3445/Runtime-Compilation-A-NET-eval-statement

like image 42
Anuraj Avatar answered Jun 06 '26 01:06

Anuraj



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!