protected override void RemoveProjectItem(IProjectItem projectItem, bool deleteFiles) { try { if (projectItem.Children.Any <IProjectItem>()) { base.RemoveProjectItems(deleteFiles, projectItem.Children.ToArray <IProjectItem>()); } base.RemoveProjectItem(projectItem, deleteFiles); if (projectItem.IsOpen) { projectItem.CloseDocument(); } base.OnItemRemoved(new ProjectItemEventArgs(projectItem)); if (deleteFiles) { base.DeleteProjectItem(projectItem); } } finally { projectItem.Dispose(); } }