[Mono-list] Running the compiler with cmd or another, since a program in C #.

jbg77 jbgaume at gmail.com
Mon Aug 13 10:39:26 UTC 2012


It's done ;)


    CSharpCodeProvider codeProvider = new CSharpCodeProvider();  		   
    string Output = "Out.exe";
        
    System.CodeDom.Compiler.CompilerParameters parameters = new
CompilerParameters();
    //Make sure we generate an EXE, not a DLL
    parameters.GenerateExecutable = true;
    parameters.OutputAssembly = Output;

    parameters.ReferencedAssemblies.Add( "System.dll" );
    parameters.ReferencedAssemblies.Add( "System.Core.dll" );
    parameters.ReferencedAssemblies.Add( "Dll\\OpenTK.dll" );
    parameters.ReferencedAssemblies.Add(
"Dll\\MonoGame.Framework.Windows.dll" );
    parameters.ReferencedAssemblies.Add( "Dll\\Tao.Sdl.dll" );
        
        
    string[] SourceFile = new string[]{"Bin\\Game1.cs",
"Bin\\GameObject.cs","Bin\\Program.cs", "Bin\\Room.cs", "Bin\\Sprite.cs"};
    CompilerResults results =
codeProvider.CompileAssemblyFromFile(parameters, SourceFile);
        
    if (results.Errors.Count > 0)
    {
        foreach (CompilerError CompErr in results.Errors)
        {
            Console.WriteLine("Line number " + CompErr.Line +
        		          ", Error Number: " + CompErr.ErrorNumber +
        		          ", '" + CompErr.ErrorText + ";" +
        		          Environment.NewLine + Environment.NewLine);
        }
    }
    else
    {
       Console.WriteLine("Success");
    }



--
View this message in context: http://mono.1490590.n4.nabble.com/Running-the-compiler-with-cmd-or-another-since-a-program-in-C-tp4650900p4650905.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list