the CSharpCodeProvider can easily be used to generate an assembly (dll or exe) at runtime, like that:
CompilerParameters param = new CompilerParameters();
param.CompilerOptions = "/target:library";
CompilerResults results = new CSharpCodeProvider().CompileAssemblyFromSource(param,code);
I need to generate not an assembly, but a module. On command line, this is easy:
csc /target:module test.cs
But using above code (by changing the CompilerOptions) ends up in an exception, because a module is not an assembly. So obviously, the method CompileAssemblyFromSource cannot be used for that. How to generate a module at runtime?
View Complete Post