How to compile c# code into memory?

.net, c#, compilation, compiler-construction

Solution

I think you're just looking for `CompilerParameters.GenerateInMemory`.

Set that to true for the compiler parameters you pass in when compiling, and it won't generate a file.

Problem

I'm using Microsoft's CSharpCodeProvider to dynamically create and execute code. Right now, it creates an assembly in a dll, located inside a temporary folder. I want for it to create an assembly in memory without having to write it to a hard drive. How do I do that?

Original source

Related problems