public int OnBeforeCloseProject(IVsHierarchy pHierarchy, int fRemoved) { var project = pHierarchy.AsProject(); if (project != null) { this.UnhookGoose(project.FileName); } return VSConstants.S_OK; }