/// <summary> /// Delete a project reference and anything else relating to it /// </summary> /// public void DeleteProjectReferenceAndRelated(VisualStudioSolutionProjectReference projectReference) { Guard.NotNull(projectReference, nameof(projectReference)); var projectId = projectReference.Id; // // Delete related NestedProjects entries // for (;;) { var nesting = NestedProjects.FirstOrDefault(n => n.ParentProjectId == projectId || n.ChildProjectId == projectId); if (nesting == null) { break; } DeleteNestedProject(nesting); } // // Delete related project configurations // for (;;) { var configuration = ProjectConfigurations.FirstOrDefault(c => c.ProjectId == projectId); if (configuration == null) { break; } DeleteProjectConfiguration(configuration); } // // Delete the project reference itself // DeleteProjectReference(GetProjectReference(projectId)); }