// Run on Mono public bool TestInMono() { // Registry Helper Obj Mfconsulting.Vsprj2make.RegistryHelper regH = new RegistryHelper(); // MonoLaunchHelper Mfconsulting.Vsprj2make.MonoLaunchHelper launchHlpr = new MonoLaunchHelper(); // Web bool isWebProject = false; string aciveFileSharePath = @"C:\inetpub\wwwroot"; string startPage = "index.aspx"; string portForXsp = "8189"; // Other string startUpProject = ""; string projectOutputFileName = ""; string projectOutputPathFromBase = ""; int projectOutputType = 0; string projectOutputWorkingDirectory = ""; EnvDTE.Solution thisSln = _applicationObject.Solution; // Run in Mono Process System.Diagnostics.ProcessStartInfo procInfo = new ProcessStartInfo(); System.Diagnostics.Process monoLauncC = new System.Diagnostics.Process(); monoLauncC.StartInfo = procInfo; // Get the Solution's startup project for (int propIdx = 1; propIdx <= thisSln.Properties.Count; propIdx++) { if (thisSln.Properties.Item(propIdx).Name.CompareTo("StartupProject") == 0) { startUpProject = thisSln.Properties.Item(propIdx).Value.ToString(); } } // Run in Mono EnvDTE.Projects projs = thisSln.Projects; foreach (EnvDTE.Project proj in projs) { if (startUpProject.CompareTo(proj.Name) == 0) { foreach (EnvDTE.Property prop in proj.Properties) { try { if (prop.Name.CompareTo("ProjectType") == 0) { if (Convert.ToInt32(prop.Value) == 1) { isWebProject = true; portForXsp = regH.Port.ToString(); } } // Web Root for XSP if (prop.Name.CompareTo("ActiveFileSharePath") == 0) { aciveFileSharePath = prop.Value.ToString(); } if (prop.Name.CompareTo("OutputType") == 0) { projectOutputType = Convert.ToInt32(prop.Value); } if (prop.Name.CompareTo("OutputFileName") == 0) { projectOutputFileName = prop.Value.ToString(); } if (prop.Name.CompareTo("LocalPath") == 0) { projectOutputWorkingDirectory = prop.Value.ToString(); } } catch (System.Runtime.InteropServices.COMException exc) { Trace.WriteLine(String.Format("Error during RunOnMono function call:\n {0}", exc.Message)); } } // Active Configuration Properties foreach (EnvDTE.Property prop in proj.ConfigurationManager.ActiveConfiguration.Properties) { // XSP startup page if (prop.Name.CompareTo("StartPage") == 0) { startPage = prop.Value.ToString(); } // Output path for non web projects if (prop.Name.CompareTo("OutputPath") == 0) { projectOutputPathFromBase = prop.Value.ToString(); } } // If is an Executable and not a DLL or web project // then launch it with monoLaunchC if (isWebProject == false && (projectOutputType == 0 || projectOutputType == 1)) { monoLauncC.StartInfo.FileName = launchHlpr.MonoLaunchCPath; monoLauncC.StartInfo.WorkingDirectory = System.IO.Path.Combine( projectOutputWorkingDirectory, projectOutputPathFromBase); monoLauncC.StartInfo.Arguments = projectOutputFileName; monoLauncC.Start(); return true; } // Web Project execution and launching of XSP if (isWebProject == true) { string startURL = String.Format( "http://localhost:{0}/{1}", portForXsp, startPage); System.Diagnostics.ProcessStartInfo procInfo1 = new ProcessStartInfo(); System.Diagnostics.Process launchStartPage = new System.Diagnostics.Process(); launchStartPage.StartInfo = procInfo1; monoLauncC.StartInfo.FileName = launchHlpr.MonoLaunchCPath; monoLauncC.StartInfo.WorkingDirectory = aciveFileSharePath; monoLauncC.StartInfo.Arguments = String.Format( "{0} --root . --port {1} --applications /:.", launchHlpr.GetXspExePath(regH.XspExeSelection), portForXsp ); // Actually start XSP monoLauncC.Start(); launchStartPage.StartInfo.UseShellExecute = true; launchStartPage.StartInfo.Verb = "open"; launchStartPage.StartInfo.FileName = startURL; // Do a little delay so XSP can launch System.Threading.Thread.Sleep(1500); launchStartPage.Start(); } } } /* string strSLNFile = _applicationObject.Solution.FileName; _applicationObject.StatusBar.Clear(); outputWindowPane.OutputString("--------------------------------------\nCompile and Run in Mono: "); outputWindowPane.OutputString(String.Format("Solution: {0}\n", strSLNFile)); _applicationObject.StatusBar.Text = "Attemp to build in Mono..."; outputWindowPane.OutputString("\tAttemp to build in Mono...\n"); // Build for Mono _applicationObject.StatusBar.Text = "Launch in Mono..."; outputWindowPane.OutputString("\tLaunch in Mono...\n"); // Lanunch in Mono */ return true; }
// Run on Mono public bool TestInMono() { // Registry Helper Obj Mfconsulting.Vsprj2make.RegistryHelper regH = new RegistryHelper(); // MonoLaunchHelper Mfconsulting.Vsprj2make.MonoLaunchHelper launchHlpr = new MonoLaunchHelper(); // Web bool isWebProject = false; string aciveFileSharePath = @"C:\inetpub\wwwroot"; string startPage = "index.aspx"; string portForXsp = "8189"; // Other string startUpProject = ""; string projectOutputFileName = ""; string projectOutputPathFromBase = ""; int projectOutputType = 0; string projectOutputWorkingDirectory = ""; EnvDTE.Solution thisSln = applicationObject.Solution; // Run in Mono Process System.Diagnostics.ProcessStartInfo procInfo = new ProcessStartInfo(); System.Diagnostics.Process monoLauncC = new System.Diagnostics.Process(); monoLauncC.StartInfo = procInfo; // Get the Solution's startup project startUpProject = thisSln.Properties.Item(5).Value.ToString(); // Run in Mono EnvDTE.Projects projs = thisSln.Projects; foreach (EnvDTE.Project proj in projs) { if (startUpProject.CompareTo(proj.Name) == 0) { foreach (EnvDTE.Property prop in proj.Properties) { if (prop.Name.CompareTo("ProjectType") == 0) { if (Convert.ToInt32(prop.Value) == 1) { isWebProject = true; portForXsp = regH.Port.ToString(); } } // Web Root for XSP if (prop.Name.CompareTo("ActiveFileSharePath") == 0) { aciveFileSharePath = prop.Value.ToString(); } if (prop.Name.CompareTo("OutputType") == 0) { projectOutputType = Convert.ToInt32(prop.Value); } if (prop.Name.CompareTo("OutputFileName") == 0) { projectOutputFileName = prop.Value.ToString(); } if (prop.Name.CompareTo("LocalPath") == 0) { projectOutputWorkingDirectory = prop.Value.ToString(); } } // Active Configuration Properties foreach (EnvDTE.Property prop in proj.ConfigurationManager.ActiveConfiguration.Properties) { // XSP startup page if (prop.Name.CompareTo("StartPage") == 0) { startPage = prop.Value.ToString(); } // Output path for non web projects if (prop.Name.CompareTo("OutputPath") == 0) { projectOutputPathFromBase = prop.Value.ToString(); } } // If is an Executable and not a DLL or web project // then launch it with monoLaunchC if (isWebProject == false && (projectOutputType == 0 || projectOutputType == 1)) { monoLauncC.StartInfo.FileName = launchHlpr.MonoLaunchCPath; monoLauncC.StartInfo.WorkingDirectory = System.IO.Path.Combine( projectOutputWorkingDirectory, projectOutputPathFromBase); monoLauncC.StartInfo.Arguments = projectOutputFileName; monoLauncC.Start(); return(true); } // Web Project execution and launching of XSP if (isWebProject == true) { string startURL = String.Format( "http://localhost:{0}/{1}", portForXsp, startPage); System.Diagnostics.ProcessStartInfo procInfo1 = new ProcessStartInfo(); System.Diagnostics.Process launchStartPage = new System.Diagnostics.Process(); launchStartPage.StartInfo = procInfo1; monoLauncC.StartInfo.FileName = launchHlpr.MonoLaunchCPath; monoLauncC.StartInfo.WorkingDirectory = aciveFileSharePath; monoLauncC.StartInfo.Arguments = String.Format( "{0} --root . --port {1} --applications /:.", launchHlpr.GetXspExePath(regH.XspExeSelection), portForXsp ); // Actually start XSP monoLauncC.Start(); launchStartPage.StartInfo.UseShellExecute = true; launchStartPage.StartInfo.Verb = "open"; launchStartPage.StartInfo.FileName = startURL; // Do a little delay so XSP can launch System.Threading.Thread.Sleep(1500); launchStartPage.Start(); } } } /* * string strSLNFile = applicationObject.Solution.FileName; * * applicationObject.StatusBar.Clear(); * outputWindowPane.OutputString("--------------------------------------\nCompile and Run in Mono: "); * outputWindowPane.OutputString(String.Format("Solution: {0}\n", strSLNFile)); * * applicationObject.StatusBar.Text = "Attemp to build in Mono..."; * outputWindowPane.OutputString("\tAttemp to build in Mono...\n"); * * // Build for Mono * * applicationObject.StatusBar.Text = "Launch in Mono..."; * outputWindowPane.OutputString("\tLaunch in Mono...\n"); * * // Lanunch in Mono */ return(true); }