protected override void Clean(MonoDevelop.Core.IProgressMonitor monitor, SolutionEntityItem item, ConfigurationSelector configuration) { var proj = item as MonoGameContentProject; MonoGameContentProjectConfiguration cfg = null; if (proj != null) { cfg = proj.GetConfiguration(configuration) as MonoGameContentProjectConfiguration; } if (proj == null) { monitor.Log.WriteLine("Cleaning for Unknown MonoGame Project"); base.Clean(monitor, item, configuration); } var manager = new PipelineManager(proj.BaseDirectory.FullPath, Path.Combine(cfg.OutputDirectory, cfg.MonoGamePlatform), cfg.IntermediateOutputDirectory); monitor.Log.WriteLine("Detected {0} MonoGame Platform", cfg.MonoGamePlatform); foreach (var file in proj.Files) { if (file.BuildAction == "Compile") { try { monitor.Log.WriteLine("Cleaning {0}", file.FilePath.FileName); manager.CleanContent(file.FilePath.FullPath, null); } catch (Exception ex) { monitor.Log.WriteLine(ex.Message); } } } base.Clean(monitor, item, configuration); }
protected override BuildResult Build(MonoDevelop.Core.IProgressMonitor monitor, IBuildTarget item, ConfigurationSelector configuration) { try { return(base.Build(monitor, item, configuration)); } finally { } }
protected override BuildResult Compile(MonoDevelop.Core.IProgressMonitor monitor, SolutionEntityItem item, BuildData buildData) { #if DEBUG monitor.Log.WriteLine("Cocos2D Extension Compile Called"); #endif try { var proj = item as Cocos2DProject; if (proj == null) { return(base.Compile(monitor, item, buildData)); } var results = new System.Collections.Generic.List <BuildResult>(); foreach (var file in proj.Files) { if (Cocos2DBuildAction.IsCocos2DBuildAction(file.BuildAction)) { buildData.Items.Add(file); var buildResult = Cocos2DContentProcessor.Compile(file, monitor, buildData); results.Add(buildResult); } } return(base.Compile(monitor, item, buildData).Append(results)); } finally { #if DEBUG monitor.Log.WriteLine("Cocos2D Extension Compile Ended"); #endif } }
public override void LoadProject(MonoDevelop.Core.IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item, MSBuildProject project) { if (UpgradeMonoGameProject(monitor, item, project)) { project.Save(project.FileName); } base.LoadProject(monitor, item, project); }
public override void SaveProject(MonoDevelop.Core.IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item, MSBuildProject project) { var changed = UpgradeMonoGameProject(monitor, item, project); base.SaveProject(monitor, item, project); if (changed) { this.LoadProject(monitor, item, project); } }
/// <summary> /// Launch Unity project /// </summary> public override void Execute(MonoDevelop.Core.IProgressMonitor monitor, IBuildTarget item, ExecutionContext context, ConfigurationSelector configuration) { if (CanExecuteProject(item as Project, context)) { DispatchService.GuiDispatch(delegate { IdeApp.Workbench.CurrentLayout = "Debug"; IdeApp.ProjectOperations.CurrentRunOperation = context.ExecutionHandler.Execute(new UnityExecutionCommand(item.BaseDirectory.FullPath), context.ConsoleFactory.CreateConsole(true)); }); } else { base.Execute(monitor, item, context, configuration); } }
protected override BuildResult Build(MonoDevelop.Core.IProgressMonitor monitor, SolutionEntityItem item, ConfigurationSelector configuration) { #if DEBUG monitor.Log.WriteLine("MonoGame Extension Build Called"); #endif try { var proj = item as Project; if (proj == null) { #if DEBUG monitor.Log.WriteLine("MonoGame Extension Null Project"); #endif return(base.Build(monitor, item, configuration)); } #if DEBUG foreach (var p in proj.GetProjectTypes()) { monitor.Log.WriteLine("MonoGame Extension Project Type {0}", p); } #endif if (!proj.GetProjectTypes().Any(x => supportedProjectTypes.ContainsKey(x))) { return(base.Build(monitor, item, configuration)); } var files = proj.Items.Where(x => x is ProjectFile).Cast <ProjectFile>(); foreach (var file in files.Where(f => f.BuildAction == "MonoGameContentReference")) { monitor.Log.WriteLine("Found MonoGame Content Builder Response File : {0}", file.FilePath); platform = proj.GetProjectTypes().FirstOrDefault(x => supportedProjectTypes.ContainsKey(x)); if (!string.IsNullOrEmpty(platform)) { try { RunMonoGameContentBuilder(file.FilePath.ToString(), supportedProjectTypes[platform], monitor); } catch (Exception ex) { monitor.ReportWarning(ex.ToString()); } } } return(base.Build(monitor, item, configuration)); } finally { #if DEBUG monitor.Log.WriteLine("MonoGame Extension Build Ended"); #endif } }
protected override BuildResult OnBuild(MonoDevelop.Core.IProgressMonitor monitor, ConfigurationSelector configuration) { var s = StartupItem as Project; if (s == null) { return new BuildResult { FailedBuildCount = 1, CompilerOutput = "No default package specified!", BuildCount = 0 } } ; return(StartupItem.Build(monitor, configuration)); } }
protected override BuildResult Build(MonoDevelop.Core.IProgressMonitor monitor, SolutionEntityItem item, ConfigurationSelector configuration) { #if DEBUG monitor.Log.WriteLine("MonoGame Extension Build Called"); #endif try { return(base.Build(monitor, item, configuration)); } finally { #if DEBUG monitor.Log.WriteLine("MonoGame Extension Build Ended"); #endif } }
public static BuildResult Compile(ProjectFile file, MonoDevelop.Core.IProgressMonitor monitor, BuildData buildData) { switch (file.BuildAction) { case "Cocos2DShader": var result = new BuildResult(); monitor.Log.WriteLine("Compiling Shader"); monitor.Log.WriteLine("Shader : " + buildData.Configuration.OutputDirectory); monitor.Log.WriteLine("Shader : " + file.FilePath); monitor.Log.WriteLine("Shader : " + file.ToString()); return(result); default: return(new BuildResult()); } }
protected override BuildResult Compile(MonoDevelop.Core.IProgressMonitor monitor, SolutionEntityItem item, BuildData buildData) { try { var proj = item as MonoGameProject; if (proj == null) { return(base.Compile(monitor, item, buildData)); } var results = new System.Collections.Generic.List <BuildResult>(); foreach (var file in proj.Files) { if (MonoGameBuildAction.IsMonoGameBuildAction(file.BuildAction)) { buildData.Items.Add(file); var buildresults = MonoGameContentProcessor.Compile(file, monitor, buildData); results.Add(buildresults); } } return(base.Compile(monitor, item, buildData).Append(results)); } finally { } }
protected override BuildResult Compile(MonoDevelop.Core.IProgressMonitor monitor, SolutionEntityItem item, BuildData buildData) { var proj = item as Project; if (proj == null) { return(base.Compile(monitor, item, buildData)); } if (!proj.GetProjectTypes().Any(x => supportedProjectTypes.ContainsKey(x))) { return(base.Compile(monitor, item, buildData)); } var files = buildData.Items.Where(x => x is ProjectFile).Cast <ProjectFile>().ToArray(); foreach (var file in files.Where(f => f.BuildAction == "MonoGameContentReference")) { var path = System.IO.Path.Combine(Path.GetDirectoryName(file.FilePath.ToString()), "bin", supportedProjectTypes[platform]); monitor.Log.WriteLine("Processing {0}", path); if (!Directory.Exists(path)) { continue; } foreach (var output in Directory.GetFiles(path, "*.*", SearchOption.AllDirectories)) { var link = string.Format("Content{0}", output.Replace(path, "")); if (proj.Files.FirstOrDefault(x => Path.GetFileName(x.FilePath.ToString()) == Path.GetFileName(output)) == null) { monitor.Log.WriteLine("Auto Including Content {0}", output); proj.Files.Add(new ProjectFile(output, BuildAction.BundleResource) { Link = new MonoDevelop.Core.FilePath(link), Flags = ProjectItemFlags.DontPersist | ProjectItemFlags.Hidden, Visible = false, }); } } } return(base.Compile(monitor, item, buildData)); }
protected override BuildResult OnBuild(MonoDevelop.Core.IProgressMonitor monitor, ConfigurationSelector configuration) { var restResult = RestClient.CompileScripts(); var result = new BuildResult(); foreach (var message in restResult.Messages) { var file = BaseDirectory + "/" + message.File; var msg = message.Message; var errorNum = ""; var messageStrings = message.Message.Split(':'); if (messageStrings.Length == 3) { var errorNumStrings = messageStrings[1].Split(' '); if (errorNumStrings.Length > 1) { errorNum = errorNumStrings[errorNumStrings.Length - 1]; } msg = messageStrings[2]; } if (message.Type == "warning") { result.AddWarning(file, message.Line, message.Column, errorNum, msg); } else { result.AddError(file, message.Line, message.Column, errorNum, msg); } } return(result); }
public MonitorBuilder (MonoDevelop.Core.IProgressMonitor monitor, BuildResult result) { this.monitor = monitor; this.result = result; }
static bool UpgradeMonoGameProject(MonoDevelop.Core.IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item, MSBuildProject project) { bool needsSave = false; bool containsMGCB = project.ItemGroups.Any(x => x.Items.Any(i => System.IO.Path.GetExtension(i.Include) == ".mgcb")); bool isMonoGame = project.PropertyGroups.Any(x => x.Properties.Any(p => p.Name == "MonoGamePlatform")) || project.ItemGroups.Any(x => x.Items.Any(i => i.Name == "Reference" && i.Include == "MonoGame.Framework")) || containsMGCB; bool isApplication = project.PropertyGroups.Any(x => x.Properties.Any(p => p.Name == "OutputType" && p.GetValue() == "Exe")) || project.PropertyGroups.Any(x => x.Properties.Any(p => p.Name == "AndroidApplication" && string.Compare(p.GetValue(), bool.TrueString, true) == 0)); bool isShared = project.PropertyGroups.Any(x => x.Properties.Any(p => p.Name == "HasSharedItems" && p.GetValue() == "true")); var type = item.GetType().Name; var platform = Environment.OSVersion.Platform == PlatformID.Win32NT ? "Windows" : "DesktopGL"; switch (type) { case "XamarinIOSProject": platform = "iOS"; break; case "MonoDroidProject": platform = "Android"; break; case "MonoGameProject": platform = "DesktopGL"; break; } if (isMonoGame) { var ritems = new List <MSBuildItem> (); foreach (var ig in project.ItemGroups) { foreach (var i in ig.Items.Where(x => x.Name == "Reference" && x.Include == "MonoGame.Framework")) { if (!i.HasMetadata("HintPath")) { monitor.Log.WriteLine("Fixing {0} to be MonoGameContentReference", i.Include); var a = ig.AddNewItem("Reference", i.Include); a.SetMetadata("HintPath", string.Format(@"$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\{0}\MonoGame.Framework.dll", platform)); ritems.Add(i); needsSave = true; } } } foreach (var a in ritems) { project.RemoveItem(a); } } if (isMonoGame && containsMGCB && (isApplication || isShared)) { if (!project.PropertyGroups.Any(x => x.Properties.Any(p => p.Name == "MonoGamePlatform")) && !isShared) { monitor.Log.WriteLine("Adding MonoGamePlatform", platform); project.PropertyGroups.First().SetPropertyValue("MonoGamePlatform", platform, true); needsSave = true; } if (!project.Imports.Any(x => x.Project.StartsWith(MonoGameCommonProps, StringComparison.OrdinalIgnoreCase)) && !isShared) { monitor.Log.WriteLine("Adding MonoGame.Common.props Import"); var e = project.Document.DocumentElement; var manager = new XmlNamespaceManager(new NameTable()); var schema = "http://schemas.microsoft.com/developer/msbuild/2003"; manager.AddNamespace("tns", schema); var import = project.Document.CreateElement("Import", schema); import.SetAttribute("Project", MonoGameCommonProps); import.SetAttribute("Conditon", string.Format("Exists('{0}')", MonoGameCommonProps)); project.Document.DocumentElement.InsertBefore(import, project.Document.DocumentElement.FirstChild); needsSave = true; } if (containsMGCB) { var ritems = new List <MSBuildItem> (); foreach (var ig in project.ItemGroups) { foreach (var i in ig.Items.Where(x => System.IO.Path.GetExtension(x.Include) == ".mgcb")) { if (i.Name != "MonoGameContentReference" && i.Name == "None") { monitor.Log.WriteLine("Fixing {0} to be MonoGameContentReference", i.Include); ig.AddNewItem("MonoGameContentReference", i.Include); ritems.Add(i); needsSave = true; } } } foreach (var a in ritems) { project.RemoveItem(a); } } if (!project.Imports.Any(x => x.Project.StartsWith(MonoGameContentBuildTargets, StringComparison.OrdinalIgnoreCase)) && !isShared) { monitor.Log.WriteLine("Adding MonoGame Content Builder .targets"); project.AddNewImport(MonoGameContentBuildTargets); needsSave = true; } } return(needsSave); }
static bool UpgradeMonoGameProject(MonoDevelop.Core.IProgressMonitor monitor, MonoDevelop.Projects.SolutionEntityItem item, MSBuildProject project) { bool needsSave = false; bool containsMGCB = project.ItemGroups.Any(x => x.Items.Any(i => System.IO.Path.GetExtension(i.Include) == ".mgcb")); bool isMonoGame = project.PropertyGroups.Any(x => x.Properties.Any(p => p.Name == "MonoGamePlatform")) || project.ItemGroups.Any(x => x.Items.Any(i => i.Name == "Reference" && i.Include == "MonoGame.Framework")) || containsMGCB; bool isApplication = project.PropertyGroups.Any(x => x.Properties.Any(p => p.Name == "OutputType" && p.GetValue() == "Exe")) || project.PropertyGroups.Any(x => x.Properties.Any(p => p.Name == "AndroidApplication" && string.Compare(p.GetValue(), bool.TrueString, true) == 0)); bool isShared = project.PropertyGroups.Any(x => x.Properties.Any(p => p.Name == "HasSharedItems" && p.GetValue() == "true")); var type = item.GetType().Name; monitor.Log.WriteLine("Found {0}", type); var platform = Environment.OSVersion.Platform == PlatformID.Win32NT ? "Windows" : "DesktopGL"; var path = MonoGameExtensionsPath; switch (type) { case "XamarinIOSProject": platform = "iOS"; break; case "MonoDroidProject": platform = "Android"; break; case "XamMac2Project": case "MonoGameProject": platform = "DesktopGL"; break; case "XamMac": case "XamMacProject": platform = "DesktopGL"; // Xamarin.Mac Classic does not use MSBuild so we need to absolute path. path = MonoGameExtensionsAbsolutePath; break; case "MonoMac": case "MonoMacProject": platform = "MacOSX"; // Xamarin.Mac Classic does not use MSBuild so we need to absolute path. path = MonoGameExtensionsAbsolutePath; break; } monitor.Log.WriteLine("Platform = {0}", platform); monitor.Log.WriteLine("Path = {0}", path); monitor.Log.WriteLine("isMonoGame {0}", isMonoGame); if (isMonoGame) { var ritems = new List <MSBuildItem> (); foreach (var ig in project.ItemGroups) { foreach (var i in ig.Items.Where(x => x.Name == "Reference" && x.Include == "MonoGame.Framework")) { if (!i.HasMetadata("HintPath")) { monitor.Log.WriteLine("Fixing {0} to be MonoGameContentReference", i.Include); var a = ig.AddNewItem("Reference", i.Include); a.SetMetadata("HintPath", string.Format(path, platform, "MonoGame.Framework.dll")); ritems.Add(i); needsSave = true; } } foreach (var i in ig.Items.Where(x => x.Name == "Reference" && x.Include == "Tao.Sdl")) { if (!i.HasMetadata("HintPath")) { monitor.Log.WriteLine("Fixing {0} to be Tao.Sdl", i.Include); var a = ig.AddNewItem("Reference", i.Include); a.SetMetadata("HintPath", string.Format(path, platform, "Tao.Sdl.dll")); ritems.Add(i); needsSave = true; } } foreach (var i in ig.Items.Where(x => x.Name == "Reference" && x.Include.StartsWith("OpenTK") && (platform != "iOS" && platform != "Android"))) { if (!i.HasMetadata("HintPath")) { monitor.Log.WriteLine("Fixing {0} to be OpenTK", i.Include); var a = ig.AddNewItem("Reference", i.Include); a.SetMetadata("HintPath", string.Format(path, platform, "OpenTK.dll")); a.SetMetadata("SpecificVersion", "true"); ritems.Add(i); needsSave = true; } } foreach (var i in ig.Items.Where(x => x.Name == "Reference" && x.Include == "NVorbis")) { if (!i.HasMetadata("HintPath")) { monitor.Log.WriteLine("Fixing {0} to be NVorbis", i.Include); var a = ig.AddNewItem("Reference", i.Include); a.SetMetadata("HintPath", string.Format(path, platform, "NVorbis.dll")); ritems.Add(i); needsSave = true; } } } foreach (var a in ritems) { project.RemoveItem(a); } var dotNetProject = item as DotNetProject; if (dotNetProject != null && (type == "MonoMacProject" || type == "XamMacProject")) { var items = new List <ProjectReference> (); var newitems = new List <ProjectReference> (); foreach (var reference in dotNetProject.References) { if (reference.Reference == "MonoGame.Framework" && string.IsNullOrEmpty(reference.HintPath)) { items.Add(reference); newitems.Add(new ProjectReference(ReferenceType.Assembly, reference.Reference, string.Format(path, platform, "MonoGame.Framework.dll"))); } if (reference.Reference.StartsWith("OpenTK") && string.IsNullOrEmpty(reference.HintPath)) { items.Add(reference); newitems.Add(new ProjectReference(ReferenceType.Assembly, reference.Reference, string.Format(path, platform, "OpenTK.dll"))); } if (reference.Reference == "NVorbis" && string.IsNullOrEmpty(reference.HintPath)) { items.Add(reference); newitems.Add(new ProjectReference(ReferenceType.Assembly, reference.Reference, string.Format(path, platform, "NVorbis.dll"))); } if (reference.Reference == "Tao.Sdl" && string.IsNullOrEmpty(reference.HintPath)) { items.Add(reference); newitems.Add(new ProjectReference(ReferenceType.Assembly, reference.Reference, string.Format(path, platform, "Tao.Sdl.dll"))); } } dotNetProject.References.RemoveRange(items); dotNetProject.References.AddRange(newitems); } } if (isMonoGame && containsMGCB && (isApplication || isShared)) { if (!project.PropertyGroups.Any(x => x.Properties.Any(p => p.Name == "MonoGamePlatform")) && !isShared) { monitor.Log.WriteLine("Adding MonoGamePlatform", platform); project.PropertyGroups.First().SetPropertyValue("MonoGamePlatform", platform, true); needsSave = true; } if (!project.Imports.Any(x => x.Project.StartsWith(MonoGameCommonProps, StringComparison.OrdinalIgnoreCase)) && !isShared) { monitor.Log.WriteLine("Adding MonoGame.Common.props Import"); var e = project.Document.DocumentElement; var manager = new XmlNamespaceManager(new NameTable()); var schema = "http://schemas.microsoft.com/developer/msbuild/2003"; manager.AddNamespace("tns", schema); var import = project.Document.CreateElement("Import", schema); import.SetAttribute("Project", MonoGameCommonProps); import.SetAttribute("Condition", string.Format("Exists('{0}')", MonoGameCommonProps)); project.Document.DocumentElement.InsertBefore(import, project.Document.DocumentElement.FirstChild); needsSave = true; } if (containsMGCB) { var ritems = new List <MSBuildItem> (); foreach (var ig in project.ItemGroups) { foreach (var i in ig.Items.Where(x => System.IO.Path.GetExtension(x.Include) == ".mgcb")) { if (i.Name != "MonoGameContentReference" && i.Name == "None") { monitor.Log.WriteLine("Fixing {0} to be MonoGameContentReference", i.Include); ig.AddNewItem("MonoGameContentReference", i.Include); ritems.Add(i); needsSave = true; } } } foreach (var a in ritems) { project.RemoveItem(a); } } if (!project.Imports.Any(x => x.Project.StartsWith(MonoGameContentBuildTargets, StringComparison.OrdinalIgnoreCase)) && !isShared) { monitor.Log.WriteLine("Adding MonoGame Content Builder .targets"); project.AddNewImport(MonoGameContentBuildTargets); needsSave = true; } } return(needsSave); }
public MonitorBuilder(MonoDevelop.Core.IProgressMonitor monitor, BuildResult result) { this.monitor = monitor; this.result = result; }
protected override BuildResult Compile(MonoDevelop.Core.IProgressMonitor monitor, SolutionEntityItem item, BuildData buildData) { #if DEBUG monitor.Log.WriteLine("MonoGame Extension Compile Called"); #endif try { var cfg = buildData.Configuration as MonoGameContentProjectConfiguration; var proj = item as MonoGameContentProject; if (proj == null || cfg == null) { monitor.Log.WriteLine("Compiling for Unknown MonoGame Project"); return(base.Compile(monitor, item, buildData)); } monitor.Log.WriteLine("Detected {0} MonoGame Platform", cfg.MonoGamePlatform); var result = new BuildResult(); var manager = new PipelineManager(proj.BaseDirectory.FullPath, Path.Combine(buildData.Configuration.OutputDirectory, cfg.MonoGamePlatform), buildData.Configuration.IntermediateOutputDirectory); manager.Logger = new MonitorBuilder(monitor, result); manager.Platform = (TargetPlatform)Enum.Parse(typeof(TargetPlatform), cfg.MonoGamePlatform); try { foreach (var pr in proj.ParentSolution.GetAllProjects()) { if (pr is DotNetAssemblyProject) { var dot = pr as DotNetAssemblyProject; foreach (var r in dot.References) { if (r.Package.Name == "monogame-contentpipeline") { var output = dot.GetOutputFileName(buildData.ConfigurationSelector).FullPath; monitor.Log.WriteLine("Adding {0} to Content Pipeline Assembly List", output); manager.AddAssembly(output); proj.Manager.AddAssembly(output); break; } } } } } catch (Exception ex) { result.AddWarning(string.Format("Problem processing Content Extensions {0}", ex.Message)); } var dict = new Microsoft.Xna.Framework.Content.Pipeline.OpaqueDataDictionary(); if (cfg != null) { if (cfg.XnaCompressContent.ToLowerInvariant() == "true") { // tell the manager to compress the output } } foreach (var file in proj.Files) { if (file.BuildAction == "Compile") { try { dict.Clear(); foreach (object key in file.ExtendedProperties.Keys) { string k = key as string; if (k != null && k.StartsWith("ProcessorParameters_")) { if (!dict.ContainsKey(k.Replace("ProcessorParameters_", String.Empty))) { dict.Add(k.Replace("ProcessorParameters_", String.Empty), file.ExtendedProperties[k]); } else { dict[k.Replace("ProcessorParameters_", String.Empty)] = file.ExtendedProperties[k]; } } } // check if the file has changed and rebuild if required. manager.BuildContent(file.FilePath.FullPath, null, file.ExtendedProperties.Contains("Importer") ? (string)file.ExtendedProperties["Importer"] : null, file.ExtendedProperties.Contains("Processor") ? (string)file.ExtendedProperties["Processor"] : null, dict); } catch (Exception ex) { monitor.Log.WriteLine(ex.ToString()); result.AddError(ex.Message); } } } return(result); } finally { #if DEBUG monitor.Log.WriteLine("MonoGame Extension Compile Ended"); #endif } }
void RunMonoGameContentBuilder(string responseFile, string platform, MonoDevelop.Core.IProgressMonitor monitor) { var process = new Process(); var location = Path.Combine(Path.GetDirectoryName(typeof(MonoGameBuildExtension).Assembly.Location), "MGCB.exe"); if (!File.Exists(location)) { switch (Environment.OSVersion.Platform) { case PlatformID.Win32NT: location = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), @"MSBuild\MonoGame\v3.0\Tools", "MGCB.exe"); break; case PlatformID.Unix: if (Directory.Exists("/Applications") && Directory.Exists("/Users")) { location = Path.Combine("/Applications/Pipeline.app/Contents/MonoBundle", "MGCB.exe"); } else { location = Path.Combine("/bin", "mgcb"); } break; case PlatformID.MacOSX: location = Path.Combine("/Applications/Pipeline.app/Contents/MonoBundle", "MGCB.exe"); break; } } if (!File.Exists(location)) { monitor.Log.WriteLine("MGCB.exe not found"); return; } process.StartInfo.WorkingDirectory = Path.GetDirectoryName(responseFile); if (Environment.OSVersion.Platform == PlatformID.Win32NT) { process.StartInfo.FileName = location; process.StartInfo.Arguments = string.Format("/@:\"{1}\" /platform:{0}", platform, responseFile); } else if (Directory.Exists("/Applications") && Directory.Exists("/Users")) { process.StartInfo.FileName = "mono"; process.StartInfo.Arguments = string.Format("\"{0}\" /@:\"{2}\" /platform:{1}", location, platform, responseFile); } else { process.StartInfo.FileName = location; process.StartInfo.Arguments = string.Format("/@:\"{1}\" /platform:{0}", platform, responseFile); } process.StartInfo.CreateNoWindow = true; process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.OutputDataReceived += (sender, args) => monitor.Log.WriteLine(args.Data); monitor.Log.WriteLine("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments); // Fire off the process. process.Start(); process.BeginOutputReadLine(); process.WaitForExit(); }