0

How to create a program (Parent Program) that creates .cs(generate source code programatically from a Parent Program) file and compile it and execute after successfull compilation and communicate result with Parent program.

What i done is

Step 1: i can create file using c# application using System.IO namespace

Step 2: there is option that we can compile program by command line using "csc" from console can execute it by using Prosess.Start() in System.Globalization namespace

But the Problems are

  1. how to know it's compiled properly.

  2. how to communicate Parent program with generated program

Civa
  • 2,058
  • 2
  • 18
  • 30

1 Answers1

2

Take a look at System.Reflection.Emit - that allows you to generate MSIL assemblies at runtime. Here are two starting points:

http://msdn.microsoft.com/en-us/library/system.reflection.emit.aspx

http://msdn.microsoft.com/en-us/library/3y322t50.aspx

KristoferA
  • 12,287
  • 1
  • 40
  • 62