海鸥航迹

学习之笔记,好文之收集。

Ankh菜单删除

今天下载了AnkhSVN 试用来一番。它是一个Visual Studio IDE的一个插件,感觉仍然不如VSS或者Visual SVN方便,Unintall后,居然发现VS2005菜单上,仍然有AnkhSVN的菜单项目。要删除它,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

这个宏文件必须在VS 的宏IDE中打开,直接保存为VBS项目运行必会报错的(谁试运行了不报错的可要留言)。

你可以把它添加到任意一个宏项目或新建一个宏项目,然后运行之即可。需要注意的是,这个宏会运行很久,在我的T42上估计用了大约10多分钟。

还一个解决办法就是导出VS IDE的设置,然后重置IDE。但这会丢失所有的自定义设置。如果自定义不多,完全可以使用这个方法。 只好再次回到Visual SVN了,唉...

源码控制,仍然推荐使用SVN。

Tag标签: snv,Ankh,VS2005

posted on 2008-04-09 22:01 海天一鸥 阅读(1767) 评论(7)  编辑 收藏 所属分类: 企业级应用

评论

#1楼  2008-04-10 08:28 李战      

俺还不知道AnkhSVN和Visual SVN呢,等俺搞来试试,多谢!

  回复  引用  查看    

#2楼  2008-04-10 08:38 oldrev [未注册用户]

AnkhSVN 强制一个 sln 建一个 SVN 仓库,没什么用   回复  引用    

#3楼  2008-04-10 08:56 Justin      

我们用ClearCase,版本工具有一个用就行了
支持一下lz的分享精神!   回复  引用  查看    

#4楼  2008-04-10 09:08 生鱼片      

只用过VSS和TeamStudio(lotus平台的)   回复  引用  查看    

#5楼  2008-04-10 09:53 Schiller John      

svn 还是小乌龟好用,用插件可能是方便点,不过速度性能上让人郁闷   回复  引用  查看    

#6楼  2008-04-11 00:14 没有昵称      

我靠。鸟svn,搞得我折腾了一天一肚子火,到后面才发觉svn验证密码那里,用户名是大小写敏感。我ft了,这辈子第一次见用户名大小写敏感的系统。
也不知道哪位大侠写的这个模块。   回复  引用  查看    

#7楼  2008-04-11 13:50 BB2008 [未注册用户]

AnkhSVN不好用,把svn本身的性能都丢了.比vs都慢~~~~   回复  引用    


标题  
姓名  
主页
Email (只有博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
该文被作者在 2008-04-09 22:07 编辑过
 
另存  打印