DTE.Addins.Update是什么用的?
我使用VS2008,下面代码Shell前和Shell后插件的个数没变。
Public Sub OnConnection(ByVal application As Object, ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, ByRef custom As Array) Implements IDTExtensibility2.OnConnection
_applicationObject = CType(application, DTE2)
_addInInstance = CType(addInInst, AddIn)
Me.AddInExample(_applicationObject)
End Sub
Sub AddInExample(ByVal DTE As DTE2)
Dim addincoll As AddIns
addincoll = DTE.AddIns
MsgBox("Number of Add-ins: " & addincoll.Count)
Shell("C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm e:\1\1.dll")
addincoll.Update()
MsgBox("Number of Add-ins: " & addincoll.Count)
End Sub
Sub AddInsExample()
' For this example to work correctly, there should be an add-in
' available in the Visual Studio .NET environment.
' Set object references.
Dim addincoll As AddIns
Dim addinobj As AddIn
' Register an Add-in, check DTE Add-in count before and after the
' Update.
addincoll = DTE.AddIns
MsgBox("AddIns collection parent name: " & addincoll.Parent.Name)
MsgBox("Number of Add-ins: " & addincoll.Count)
' NOTE: Use regsvr32 for Visual C++ .NET, regasm for Visual Basic .NET
' and Visual C# .NET. Also, the pathname used below is an example only.
Shell("regasm F:\AddIns\RegExplore\Debug\regexplore.dll")
addincoll.Update()
MsgBox("Number of Add-ins: " & addincoll.Count)
addinobj = addincoll.Item(1)
End Sub
' Open a solution before running this example.
Dim soln As Solution
' Create a reference to the solution.
soln = DTE.Solution
' List number of Add-ins.
MsgBox(soln.AddIns.Count)