How to compile c# code dynamically?

  • Thread starter Thread starter Senthil Kumar via .NET 247
  • Start date Start date
S

Senthil Kumar via .NET 247

Hi Frends,

I have a "a.aspx.cs" and "b.aspx.cs", can i compile b.aspx.cs from a.aspx.cs?

Thanks in advance

Best Regards,
Senthil kumar Ramachandran
 
Take a look at:
http://www.codeproject.com/dotnet/CodeFromCode.asp

It's in VB.NET, but you should be able to translate it pretty easily.

In particular, look at the ProcessExpression method, the part commented as
"Compiling the source file to an assembly DLL (IL code)."

Then the very next section shows how to call something from the compiled
code.
 
Back
Top