Possible Duplicate:
How to programatically build and compile another c# project from the current project
Lets say we have an application named Program1.exe so when i click that exe that program has to create another exe lets say Program2.exe which write “hello world” on screen. So I think its possible using command line tool of visual studio using csc command in code, anyway if its possible can that Program2.exe replace Program1.exe? I mean that Program1.exe can re-compile in runtime?
sure you can do this, have a look at the class:
Microsoft.CSharp.CSharpCodeProviderand at this article: Compiling and Executing Code at Runtime
P.S. you are not really calling the csc command from code, but something way lower, in my understanding… which is good anyway as you use managed classes and not an external tool.