/// <summary> /// Builds the given projects /// </summary> /// <param name="projects"></param> /// <returns></returns> public virtual async Task Build(IEnumerable <Project> projects) { SolutionBuildStarted?.Invoke(this, new EventArgs()); Dictionary <Project, bool> toBuild = new Dictionary <Project, bool>(); // Key: project, value: if it has been built foreach (var item in projects) { if (!item.HasCircularReferences()) { // Stop if the build has been canceled. if (IsCancelRequested) { return; } toBuild.Add(item, false); } else { throw (new ProjectCircularReferenceException()); } } var toBuildKeys = toBuild.Keys.ToList(); // Because C# doesn't allow getting `toBuild.Keys[count]` for (var count = 0; count < toBuild.Keys.Count; count++) { // Stop if the build has been canceled. if (IsCancelRequested) { return; } var key = toBuildKeys[count]; // If this project has not been built if (!toBuild[key]) { // Then build the project, but build its dependencies first await BuildProjects(toBuild, key); } } SolutionBuildCompleted?.Invoke(this, new EventArgs()); }
int IVsUpdateSolutionEvents2.UpdateSolution_Begin(ref int pfCancelUpdate) { SolutionBuildStarted?.Invoke(this, EventArgs.Empty); return(VSConstants.S_OK); }