0

I have a textbox called ssd.
I want it to compile the C# code in it to "Prgoram.exe" at the same location.
I tried this:

                CSharpCodeProvider codeProvider = new CSharpCodeProvider();
                ICodeCompiler icc = codeProvider.CreateCompiler();
                System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters();
                parameters.GenerateExecutable = true;
                parameters.CompilerOptions = "/target:winexe";
                parameters.OutputAssembly = "Program.exe";
                parameters.GenerateInMemory = false; 
                CompilerResults results = codeProvider.CompileAssemblyFromSource(parameters, ssd.Text);

But it's not working. Can you solve it please?

Thanks in advance.

2
Contributors
4
Replies
35
Views
4 Years
Discussion Span
Last Post by waseem1345
0

It have 2 errors because I'm using the windows.forms...
How to add a reference to the compiler?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.