/// <summary> /// Called when the add-in is about to be unloaded. /// </summary> private void ThisAddIn_Shutdown(object sender, EventArgs e) { if (!MessageFilter.Revoke()) { SyncServiceTrace.W("Failed to unregister message handler"); } Settings.Default.Save(); AssemblyInit.Instance.Dispose(); AIT.TFS.SyncService.Adapter.TFS2012.AssemblyInit.Instance.Dispose(); AIT.TFS.SyncService.Adapter.Word2007.AssemblyInit.Instance.Dispose(); // Make sure the temp folder is not deleted by "Nested Adapters" when generating test reports. var counter = Process.GetProcesses().Count(process => process.ProcessName.Contains("WINWORD")); if (counter == 1) { TempFolder.ClearTempFolder(); } }