Creating assembly from multiple files at runtime

  • Thread starter Thread starter Andrus
  • Start date Start date
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.
 
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
 
Back
Top