BuildResult CreateBuildResult(ProcessAsyncOperation operation, ConsoleWrapper console)
        {
            if (operation.Task.IsFaulted || operation.ExitCode != 0)
            {
                BuildResult result = console.GetBuildResult(project);
                if (!(result.HasErrors || result.HasWarnings))
                {
                    result.AddError(GettextCatalog.GetString("Build failed. Please see the Build Output for more details."));
                }
                return(result);
            }

            return(console.GetBuildResult(project));
        }
        public Task <BuildResult> BuildAsnc(DotNetProjectConfiguration config)
        {
            var console = new ConsoleWrapper(monitor);

            ProcessAsyncOperation operation = Runtime.ProcessService.StartConsoleProcess(
                DnxServices.ProjectService.CurrentDotNetRuntimePath,
                String.Format("build --configuration {0} --no-dependencies", config.Name),
                project.BaseDirectory,
                console,
                null,
                (sender, e) => { }
                );

            return(operation.Task.ContinueWith(t => {
                return CreateBuildResult(operation, console);
            }));
        }