I want some code that compiles the code that is in my TextBox (for example). What I mean is I want to compile code after running the program. How can I do this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
See this article:
http://support.microsoft.com/kb/304655
Here’s the sample code they provide:
As Aliostad has mentioned in his answer, be careful with this solution, though. You will need to make sure your compiled code ends up in its own
AppDomain, otherwise you will experience memory leaks.See this related question on how to load the code into a separate
AppDomain:How can I prevent CompileAssemblyFromSource from leaking memory?