Creating assembly from multiple files at runtime

A

Andrus

I need to create assembly at runtime from multiple pre-compiled obj and cs
files embedded into
resource file. I have found only samples which create assembly from single
file like

Microsoft.CSharp.CSharpCodeProvider provider = new
Microsoft.CSharp.CSharpCodeProvider
(new Dictionary<string, string>() { { "CompilerVersion",
"v3.5" } });

CompilerParameters compilerParameters = new CompilerParameters {

GenerateInMemory = true };

CompilerResults compilerResults =
provider.CompileAssemblyFromSource(compilerParameters, code);
return compilerResults.CompiledAssembly;


How to create assembly from multiple files ?

Andrus.
 
J

Jon Skeet [C# MVP]

I need to create assembly at runtime from multiple pre-compiled obj and cs
files embedded into
resource file. I have found only samples which create assembly from single
file like

Microsoft.CSharp.CSharpCodeProvider provider = new
Microsoft.CSharp.CSharpCodeProvider
(new Dictionary<string, string>() { { "CompilerVersion",
"v3.5" } });

CompilerParameters compilerParameters = new CompilerParameters {

GenerateInMemory = true };

CompilerResults compilerResults =
provider.CompileAssemblyFromSource(compilerParameters, code);
return compilerResults.CompiledAssembly;

How to create assembly from multiple files ?

See CompileAssemblyFromFile, which takes multiple filenames.

However, they all need to be source files as far as I'm aware - not a
mixture of .cs and .obj files.

Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top