By the way, the parameter sourceTexts contains C# source code in each string, not the 
filename of the source file in each string.

Here is an example built with csc and ran on .NET Framework.

//
// CompileTest.cs
//

using System;
using System.Collections;

namespace McsTest {
        class TestMcs {
                public static void Main(string[] args) {
                        Console.WriteLine("CompileTest: Started.");
                        string TestHelloSource = 
                                "using System;\n" +
                                "namespace Test {\n" +
                                "class TestHello {\n" +
                                "public static void Main(string[] ars) {\n" +
                                "Console.WriteLine(\"Test Hello\");\n" +
                                "}\n" +
                                "}\n" +
                                "}\n" +
                                "\n";
                        string TestHelloFilename = "TestHello.cs";

                        Microsoft.CSharp.CompilerError[] errors;
                        string[] sourceTexts;
                        string[] sourceTextNames;
                        string target;
                        string[] imports = null;
                        IDictionary options = null;

                        sourceTexts = new string[1] {TestHelloSource};
                        sourceTextNames = new string[1] {TestHelloFilename};
                        target = "TestHello.exe";
                        
                        errors = Microsoft.CSharp.Compiler.Compile(sourceTexts,
                                sourceTextNames, target, imports,
                                options);

                        if(errors.Length == 0) {
                                Console.WriteLine("CompileTest:  Success.");
                        }
                        else {
                                for(int e = 0; e < errors.Length; e++) {
                                        string error = errors[e].ToString();
                                        Console.WriteLine("Error: " + error);
                                }
                                Console.WriteLine("CompileTest: Failure.");
                        }
                        Console.WriteLine("CompileTest: Done.");
                }
        }
}

$ csc CompileTest.cs /r:System.dll /r:Cscompmgd.dll
Microsoft (R) Visual C# .NET Compiler version 7.00.9466
for Microsoft (R) .NET Framework version 1.0.3705
Copyright (C) Microsoft Corporation 2001. All rights reserved.

$ ./CompileTest.exe
CompileTest: Started.
CompileTest:  Success.
CompileTest: Done.

$ ./TestHello.exe
Test Hello

Here is the same results built with mcs/mono and ran on mono:
$ mono f:/cygwin/home/DanielMorgan/mono/install/bin/mcs.exe CompileTest.cs
Compilation succeeded

$ mono CompileTest.exe
CompileTest: Started.
Error: error CS2001: Source file 'using' could not be opened
Error: error CS2001: Source file 'System;
Error: error CS2001: Source file 'Test' could not be opened
Error: error CS2001: Source file '{
Error: error CS2001: Source file 'TestHello' could not be opened
Error: error CS2001: Source file '{
Error: error CS2001: Source file 'static' could not be opened
Error: error CS2001: Source file 'void' could not be opened
Error: error CS2001: Source file 'Main(string[]' could not be opened
Error: error CS2001: Source file 'ars)' could not be opened
Error: error CS2001: Source file '{
CompileTest: Failure.
CompileTest: Done.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Jackson Harper
Sent: Saturday, December 07, 2002 2:02 PM
To: Guenther Roith
Cc: Monolist (E-mail)
Subject: Re: [Mono-list] Should mono implement cscompmgd.dll?



Günther,

    Thank you for pointing this out. I have moved the code into the proper
assembly.

Jackson

_______________________________________________
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


_______________________________________________
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to