public RunResult Run(string visualStudioSolutionPath, IEnumerable <DebuggingTargetViewModel> debuggingTargets, bool debug, bool runUnselected) { var targets = debuggingTargets.ToList(); var requiresVisualStudio = debug && targets.SelectMany(t => t.DebuggingEngines).Any(); Process visualStudioProcess = null; if (requiresVisualStudio) { try { visualStudioProcess = Retrier.RunWithRetryOnException(() => InstanceFinder.GetVisualStudioProcessForSolution(visualStudioSolutionPath)); } catch (AggregateException ex) { return(new RunResult { Message = $"Errors while looking for VS.NET instances {visualStudioSolutionPath}. Errors : {string.Join(". ", ex.InnerExceptions.Select(e => e.Message).ToArray())}" }); } if (visualStudioProcess == null) { return(new RunResult { Message = $"No visual studio instance found with solution {visualStudioSolutionPath}" }); } } foreach (var target in targets.Where(tr => (runUnselected || tr.Selected) && tr.CurrentProcess == null)) { RunResult run; if (!RunSingleTarget(debug, target, visualStudioProcess, out run)) { return(run); } } return(new RunResult()); }