简体   繁体   中英

How to compile a C# programm in C#

How i can make something like a "builder" for my application. Let me explain it in a example:

application.exe

System.Console;

private class Program
{
    public static void Main()
    {    
        WriteLine(message);
    }
}

Now i want to have another C# program that is able to compile this program but change the string message to what the user desires.

i hope you can understand what i mean with my bad English and bad explanation skills.

 class Program
{
    static void Main(string[] args)
    {
        if (args.Length >0)
        {
            Console.WriteLine(args[0].ToString());
            Console.ReadKey();
        }
    }
}

Complile the Program and execute it using cmd prompt with any string you want as parameter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM