It remains to adjust the compiler’s settings, this can be done by providing some parameters:

1
2
3
4
5
6

CompilerParametersparameters=newCompilerParameters();parameters.GenerateExecutable=true;// we want to save it as an .exe
parameters.GenerateInMemory=false;// it must be saved on the harddisk, not in memory
parameters.OutputAssembly="hello.exe";// the file's name
parameters.TreatWarningsAsErrors=false;//ignoringthewarnings-myfavouriteone:)

Now the compiler’s done.

3. Compiling the code

In the end, use a string to store the code you want to compile at Runtime, in this case, I’ll compile the ‘Hello World’ code written at the beginning of the tutorial.