public override void LoadPanelContents()
        {
            SetupFromXml(Path.Combine(PropertyService.DataDirectory,
                                      @"resources\panels\VBCompilerPanel.xfrm"));

            DotNetProjectConfiguration cfg = (DotNetProjectConfiguration)((IProperties)CustomizationObject).GetProperty("Config");
            config = (VBCompilerParameters) cfg.CompilationParameters;

            FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
            ((ComboBox)ControlDictionary["compilerVersionComboBox"]).Items.Add("Standard");
            foreach (string runtime in fileUtilityService.GetAvaiableRuntimeVersions()) {
                ((ComboBox)ControlDictionary["compilerVersionComboBox"]).Items.Add(runtime);
            }

            ((ComboBox)ControlDictionary["compilerVersionComboBox"]).Text = config.VBCompilerVersion.Length == 0 ? "Standard" : config.VBCompilerVersion;
        }
        public override void LoadPanelContents()
        {
            configuration = (DotNetProjectConfiguration)((IProperties)CustomizationObject).GetProperty("Config");
            parameters = (VBCompilerParameters) configuration.CompilationParameters;

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

            vbcRadioButton.Active = parameters.VBCompiler == VBCompiler.Vbc;
            mbasRadioButton.Active = parameters.VBCompiler == VBCompiler.Mbas;
        }
        public ICompilerResult Compile(ProjectFileCollection projectFiles, ProjectReferenceCollection references, DotNetProjectConfiguration configuration, IProgressMonitor monitor)
        {
            VBCompilerParameters compilerparameters = (VBCompilerParameters) configuration.CompilationParameters;
            if (compilerparameters == null) compilerparameters = new VBCompilerParameters ();

            string exe = configuration.CompiledOutputName;
            string responseFileName = Path.GetTempFileName();
            //string stdResponseFileName = String.Concat(propertyService.DataDirectory, Path.DirectorySeparatorChar, "vb.rsp");
            StreamWriter writer = new StreamWriter(responseFileName);

            //Console.WriteLine(GenerateOptions(compilerparameters,exe));
            writer.WriteLine(GenerateOptions (configuration, compilerparameters, exe));

            foreach (ProjectReference lib in references) {
                string fileName = lib.GetReferencedFileName();
                //Console.WriteLine(String.Concat("-r:",fileName));
                writer.WriteLine(String.Concat("-r:", fileName));
            }

            // write source files and embedded resources
            foreach (ProjectFile finfo in projectFiles) {
                if (finfo.Subtype != Subtype.Directory) {
                    switch (finfo.BuildAction) {
                        case BuildAction.Compile:
                            //Console.WriteLine(finfo.Name);
                            writer.WriteLine(finfo.Name);
                        break;

                        case BuildAction.EmbedAsResource:
                            //Console.WriteLine(String.Concat("-resource:", finfo.Name));
                            writer.WriteLine(String.Concat("-resource:", finfo.Name));
                        break;
                    }
                }
            }

            TempFileCollection tf = new TempFileCollection ();
            writer.Close();

            string output = "";
            string error  = "";
            string compilerName = GetCompilerName(compilerparameters.VBCompilerVersion);
            string outstr = String.Concat(compilerName, " @", responseFileName); //, " @", stdResponseFileName);

            //Console.WriteLine("Attempting to run: "+outstr);

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

            //Console.WriteLine("Output: "+output);
            //Console.WriteLine("Error: "+error);

            ICompilerResult result = ParseOutput(tf, output);
            ParseOutput(tf,error);

            File.Delete(responseFileName);
            File.Delete(output);
            File.Delete(error);
            if (configuration.CompileTarget != CompileTarget.Library) {
                WriteManifestFile(exe);
            }
            return result;
        }
        void SetValues(object sender, EventArgs e)
        {
            DotNetProjectConfiguration config = (DotNetProjectConfiguration) ((IProperties)CustomizationObject).GetProperty("Config");
            compilerParameters = (VBCompilerParameters) config.CompilationParameters;
            project = (VBProject)((IProperties)CustomizationObject).GetProperty("Project");

            ((TextBox)ControlDictionary["OutputFileTextBox"]).Text = compilerParameters.VBDOCOutputFile;
            ((TextBox)ControlDictionary["CommentPrefixTextBox"]). Text = compilerParameters.VBDOCCommentPrefix;

            foreach(ProjectFile pfile in project.ProjectFiles) {
                bool included = IsFileIncluded(pfile.Name, project);
                ((CheckedListBox)ControlDictionary["FileListBox"]).Items.Add(pfile.Name, included);
            }
        }
        string GenerateOptions(DotNetProjectConfiguration configuration, VBCompilerParameters compilerparameters, string outputFileName)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("-out:");sb.Append(outputFileName);/*sb.Append('"');*/sb.Append(Environment.NewLine);

            sb.Append("-nologo");sb.Append(Environment.NewLine);
            sb.Append("-utf8output");sb.Append(Environment.NewLine);

            //			if (compilerparameters.DebugMode) {
            //				sb.Append("--debug+");sb.Append(Environment.NewLine);
            //				sb.Append("--debug:full");sb.Append(Environment.NewLine);
            //			}

            //if (compilerparameters.Optimize) {
            //	sb.Append("-optimize");sb.Append(Environment.NewLine);
            //}

            //if (compilerparameters.OptionStrict) {
            //	sb.Append("-optionstrict");sb.Append(Environment.NewLine);
            //}

            //if (compilerparameters.OptionExplicit) {
            //	sb.Append("-optionexplicit");sb.Append(Environment.NewLine);
            //}// else {
            //	sb.Append("--optionexplicit-");sb.Append(Environment.NewLine);
            //}

            if (compilerparameters.Win32Icon != null && compilerparameters.Win32Icon.Length > 0 && File.Exists(compilerparameters.Win32Icon)) {
                sb.Append("-win32icon:");sb.Append('"');sb.Append(compilerparameters.Win32Icon);sb.Append('"');sb.Append(Environment.NewLine);
            }

            if (compilerparameters.RootNamespace!= null && compilerparameters.RootNamespace.Length > 0) {
                sb.Append("-rootnamespace:");sb.Append('"');sb.Append(compilerparameters.RootNamespace);sb.Append('"');sb.Append(Environment.NewLine);
            }

            if (compilerparameters.DefineSymbols.Length > 0) {
                sb.Append("-define:");sb.Append('"');sb.Append(compilerparameters.DefineSymbols);sb.Append('"');sb.Append(Environment.NewLine);
            }

            if (compilerparameters.MainClass != null && compilerparameters.MainClass.Length > 0) {
                sb.Append("-main:");sb.Append(compilerparameters.MainClass);sb.Append(Environment.NewLine);
            }

            if(compilerparameters.Imports.Length > 0) {
                sb.Append("-imports:");sb.Append(compilerparameters.Imports);sb.Append(Environment.NewLine);
            }

            switch (configuration.CompileTarget) {
                case CompileTarget.Exe:
                    sb.Append("-target:exe");
                    break;
                case CompileTarget.WinExe:
                    sb.Append("-target:winexe");
                    break;
                case CompileTarget.Library:
                    sb.Append("-target:library");
                    break;
                case CompileTarget.Module:
                    sb.Append("-target:module");
                    break;
                default:
                    throw new NotSupportedException("unknown compile target:" + configuration.CompileTarget);
            }
            sb.Append(Environment.NewLine);
            return sb.ToString();
        }