Ankh menu Deletion

Source: Internet
Author: User

Today I downloaded the ankhsvn trial. It is a plug-in of Visual Studio IDE and is not as convenient as VSS or visual SVN. After unintall, it is found that there is still a menu item of ankhsvn on the vs2005 menu. To delete it, Google:

Http://www.therightstuff.de/2006/09/21/Removing+AnkhSVN+Commands+From+Visual+Studio.aspx

   1:  Imports System
   2:  Imports EnvDTE
   3:  Imports System.Diagnostics
   4:  ' Comment the following line if you're running the macro in Visual Studio .NET 2003.
   5:  Imports Microsoft.VisualStudio.CommandBars
   6:  Imports Microsoft.Office.Core
   7:   
   8:  Public Module RemoveAnkhMenus
   9:      Public Sub RemoveAnkhMenus()
  10:          DeleteAnkhCommandControls()
  11:          DeleteAnkhCommands()
  12:      End Sub
  13:   
  14:      Private Sub DeleteAnkhCommandControls()
  15:          For Each bar As CommandBar In CType(DTE.CommandBars, CommandBars)
  16:              ' Debug.WriteLine(String.Format("Processing : {0}", GetPath(bar)))
  17:   
  18:              RecurseCommandControls(bar.Controls)
  19:          Next
  20:      End Sub
  21:   
  22:      Private Sub RecurseCommandControls(ByVal controls As CommandBarControls)
  23:          For Each control As CommandBarControl In controls
  24:              ' Debug.WriteLine(String.Format("Processing : {0}", GetPath(control)))
  25:   
  26:              ' Recurse childs.
  27:              If control.accChildCount > 0 Then
  28:                  If control.Type = MsoControlType.msoControlPopup Then
  29:                      RecurseCommandControls(CType(control, CommandBarPopup).Controls)
  30:                  End If
  31:              End If
  32:   
  33:              ' Delete the control if it is related to AnkhSVN.
  34:              DeleteAnkhCommandControl(control)
  35:          Next
  36:      End Sub
  37:   
  38:      Private Sub DeleteAnkhCommandControl(ByVal control As CommandBarControl)
  39:          ' Delete control if it is related to AnkhSVN.
  40:          If control.Caption.StartsWith("Ankh") Then
  41:              Debug.WriteLine(String.Format("Deleting control: {0}", GetPath(control)))
  42:              control.Delete()
  43:          End If
  44:      End Sub
  45:   
  46:      Private Sub DeleteAnkhCommands()
  47:          ' Delete all commands related to AnkhSVN.
  48:          For Each command As Command In DTE.Commands
  49:              If command.Name <> Nothing Then
  50:                  If command.Name.StartsWith("Ankh") Then
  51:                      Debug.WriteLine(String.Format("Deleting command: {0}", command.Name))
  52:                      command.Delete()
  53:                  End If
  54:              End If
  55:          Next
  56:      End Sub
  57:   
  58:      Private Function GetPath(ByVal control As Object) As String
  59:          If TypeOf (control) Is CommandBarControl Then
  60:              Dim cbc As CommandBarControl
  61:              cbc = CType(control, CommandBarControl)
  62:   
  63:              Return GetPath(cbc.Parent) + "->" + cbc.Caption
  64:          End If
  65:   
  66:          If TypeOf (control) Is CommandBar Then
  67:              Dim cb As CommandBar
  68:              cb = CType(control, CommandBar)
  69:   
  70:              Return GetPath(cb.Parent) + "->" + cb.Name
  71:          End If
  72:   
  73:          Return "DTE"
  74:      End Function
  75:  End Module

This macro file must be opened in macro ide of vs. If it is saved as a vbs project, an error will be reported when running the file (you can leave a message if no error is reported during trial run ).

You can add it to any macro project or create a new macro project, and then run it. It should be noted that this macro will run for a long time. It is estimated that it will take more than 10 minutes on t42.

Another solution is to export vs ide settings and reset the IDE. However, all custom settings are lost. You can use this method if there are not many user-defined items. I had to go back to visual SVN again...

SVN is still recommended for source code control.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.