SmithMart
SmithMart

Reputation: 2811

Compile a new console application from a running application

Is it possible to create an application in c# that can itself create another application from source code it creates dynamically?

for example, application 1 runs and asks you some basic questions. then uses the answers to those questions to compile a brand new exe for you containing your answers inside the source code?

I hope that makes sense!

Martyn

Upvotes: 0

Views: 172

Answers (2)

svick
svick

Reputation: 245038

Do you really need to create a different application every time?

Creating a generic version of that application and then configuring it using a file from the other application might be easier.

Upvotes: 0

Justin
Justin

Reputation: 86789

Yes you can using the CSharpCodeProvider class. See this code project article which gives you the general idea:

Compiling and Executing Code at Runtime

Upvotes: 3

Related Questions