public override void LoadPanelContents()
        {
            config = (DotNetProjectConfiguration)((IProperties)CustomizationObject).GetProperty("Config");
            parameters = (CSharpCompilerParameters) config.CompilationParameters;

            msnetRadioButton.Active = config.NetRuntime == NetRuntime.MsNet;
            monoRadioButton.Active  = config.NetRuntime == NetRuntime.Mono;
            mintRadioButton.Active  = config.NetRuntime == NetRuntime.MonoInterpreter;

            cscRadioButton.Active = parameters.CsharpCompiler == CsharpCompiler.Csc;
            mcsRadioButton.Active = parameters.CsharpCompiler == CsharpCompiler.Mcs;
        }
        public ICompilerResult Compile(ProjectFileCollection projectFiles, ProjectReferenceCollection references, DotNetProjectConfiguration configuration, IProgressMonitor monitor)
        {
            CSharpCompilerParameters compilerparameters = (CSharpCompilerParameters) configuration.CompilationParameters;
            if (compilerparameters == null) compilerparameters = new CSharpCompilerParameters ();

            string exe = configuration.CompiledOutputName;
            string responseFileName = Path.GetTempFileName();
            StreamWriter writer = new StreamWriter(responseFileName);

            if (compilerparameters.CsharpCompiler == CsharpCompiler.Csc) {
                writer.WriteLine("\"/out:" + exe + '"');

                ArrayList pkg_references = new ArrayList ();

                if (references != null) {
                    foreach (ProjectReference lib in references) {
                        string fileName = lib.GetReferencedFileName ();
                        switch (lib.ReferenceType) {
                        case ReferenceType.Gac:
                            string pkg = Runtime.SystemAssemblyService.GetPackageFromFullName (lib.Reference);
                            if (pkg.Trim () == String.Empty) {
                                string msg = String.Format (GettextCatalog.GetString ("{0} could not be found or is invalid."), lib.Reference);
                                Runtime.MessageService.ShowWarning (msg);
                                continue;
                            }
                            if (pkg == "MONO-SYSTEM") {
                                writer.WriteLine ("\"/r:" + Path.GetFileName (fileName) + "\"");
                            } else if (!pkg_references.Contains (pkg)) {
                                pkg_references.Add (pkg);
                                writer.WriteLine ("\"-pkg:" + pkg + "\"");
                            }
                            break;
                        case ReferenceType.Assembly:
                        case ReferenceType.Project:
                            writer.WriteLine ("\"/r:" + fileName + "\"");
                            break;
                        }
                    }
                }

                writer.WriteLine("/noconfig");
                writer.WriteLine("/nologo");
                writer.WriteLine("/codepage:utf8");
            //				writer.WriteLine("/utf8output");
            //				writer.WriteLine("/w:" + compilerparameters.WarningLevel);;

                if (configuration.DebugMode) {
                    writer.WriteLine("/debug:+");
                    writer.WriteLine("/debug:full");
                    writer.WriteLine("/d:DEBUG");
                }

                // mcs default is + but others might not be
                if (compilerparameters.Optimize)
                    writer.WriteLine("/optimize+");
                else
                    writer.WriteLine("/optimize-");

                if (compilerparameters.Win32Icon != null && compilerparameters.Win32Icon.Length > 0 && File.Exists (compilerparameters.Win32Icon)) {
                    writer.WriteLine("\"/win32icon:" + compilerparameters.Win32Icon + "\"");
                }

                if (compilerparameters.UnsafeCode) {
                    writer.WriteLine("/unsafe");
                }

                if (compilerparameters.DefineSymbols.Length > 0) {
                    writer.WriteLine("/define:" + '"' + compilerparameters.DefineSymbols + '"');
                }

                if (compilerparameters.MainClass != null && compilerparameters.MainClass.Length > 0) {
                    writer.WriteLine("/main:" + compilerparameters.MainClass);
                }

                switch (configuration.CompileTarget) {
                    case CompileTarget.Exe:
                        writer.WriteLine("/t:exe");
                        break;
                    case CompileTarget.WinExe:
                        writer.WriteLine("/t:winexe");
                        break;
                    case CompileTarget.Library:
                        writer.WriteLine("/t:library");
                        break;
                }

                foreach (ProjectFile finfo in projectFiles) {
                    if (finfo.Subtype != Subtype.Directory) {
                        switch (finfo.BuildAction) {
                            case BuildAction.Compile:
                                if (CanCompile (finfo.Name))
                                    writer.WriteLine('"' + finfo.Name + '"');
                                break;
                            case BuildAction.EmbedAsResource:
                                // FIXME: workaround 60990
                                writer.WriteLine(@"""/res:{0},{1}""", finfo.Name, Path.GetFileName (finfo.Name));
                                break;
                        }
                    }
                }
                if (compilerparameters.GenerateXmlDocumentation) {
                    writer.WriteLine("\"/doc:" + Path.ChangeExtension(exe, ".xml") + '"');
                }
            }
            else {
                writer.WriteLine("-o " + exe);

                if (compilerparameters.UnsafeCode) {
                    writer.WriteLine("--unsafe");
                }

                writer.WriteLine("--wlevel " + compilerparameters.WarningLevel);

                if (references != null) {
                    foreach (ProjectReference lib in references) {
                        string fileName = lib.GetReferencedFileName ();
                        writer.WriteLine("-r:" + fileName );
                    }
                }

                switch (configuration.CompileTarget) {
                    case CompileTarget.Exe:
                        writer.WriteLine("--target exe");
                        break;
                    case CompileTarget.WinExe:
                        writer.WriteLine("--target winexe");
                        break;
                    case CompileTarget.Library:
                        writer.WriteLine("--target library");
                        break;
                }
                foreach (ProjectFile finfo in projectFiles) {
                    if (finfo.Subtype != Subtype.Directory) {
                        switch (finfo.BuildAction) {
                            case BuildAction.Compile:
                                writer.WriteLine('"' + finfo.Name + '"');
                                break;

                            case BuildAction.EmbedAsResource:
                                writer.WriteLine("--linkres " + finfo.Name);
                                break;
                        }
                    }
                }
            }
            writer.Close();

            string output = String.Empty;
            string error  = String.Empty;

            string compilerName = compilerparameters.CsharpCompiler == CsharpCompiler.Csc ? GetCompilerName() : System.Environment.GetEnvironmentVariable("ComSpec") + " /c mcs";
            string outstr = compilerName + " @" + responseFileName;
            TempFileCollection tf = new TempFileCollection();

            //StreamReader t = File.OpenText(responseFileName);

            //Executor.ExecWaitWithCapture(outstr,  tf, ref output, ref error);
            DoCompilation(outstr, tf, ref output, ref error);

            ICompilerResult result = ParseOutput(tf, output, error);
            if (result.CompilerOutput.Trim () != "")
                monitor.Log.WriteLine (result.CompilerOutput);

            File.Delete(responseFileName);
            File.Delete(output);
            File.Delete(error);
            return result;
        }
            public CodeGenerationPanelWidget(IProperties CustomizationObject)
                : base("CSharp.glade", "CodeGenerationPanel")
            {
                configuration = (DotNetProjectConfiguration)((IProperties)CustomizationObject).GetProperty("Config");
                project = (Project)((IProperties)CustomizationObject).GetProperty("Project");
                compilerParameters = (CSharpCompilerParameters) configuration.CompilationParameters;

                ListStore store = new ListStore (typeof (string));
                store.AppendValues (GettextCatalog.GetString ("Executable"));
                store.AppendValues (GettextCatalog.GetString ("Library"));
                compileTargetCombo.Model = store;
                CellRendererText cr = new CellRendererText ();
                compileTargetCombo.PackStart (cr, true);
                compileTargetCombo.AddAttribute (cr, "text", 0);
                compileTargetCombo.Active = (int) configuration.CompileTarget;
                compileTargetCombo.Changed += new EventHandler (OnTargetChanged);

                symbolsEntry.Text = compilerParameters.DefineSymbols;

                classListStore = new ListStore (typeof(string));
                mainClassEntry.Model = classListStore;
                mainClassEntry.TextColumn = 0;
                ((Entry)mainClassEntry.Child).Text = compilerParameters.MainClass;

                UpdateTarget ();

                generateDebugInformationCheckButton.Active = configuration.DebugMode;
                generateXmlOutputCheckButton.Active        = compilerParameters.GenerateXmlDocumentation;
                enableOptimizationCheckButton.Active       = compilerParameters.Optimize;
                allowUnsafeCodeCheckButton.Active          = compilerParameters.UnsafeCode;
                generateOverflowChecksCheckButton.Active   = compilerParameters.GenerateOverflowChecks;
                warningsAsErrorsCheckButton.Active         = ! configuration.RunWithWarnings;
                warningLevelSpinButton.Value               = compilerParameters.WarningLevel;
            }