I try to write my first Add-in for Visual Studio 10.
Operation System: Microsoft Windows Server 2003 Standard Edition. Service Pack 2
I created project with Add-in (VB.NET).
Method Exec has next code:
Public Sub Exec(ByVal commandName As String, ByVal executeOption As vsCommandExecOption, ByRef varIn As Object, ByRef varOut As Object, ByRef handled As Boolean) Implements IDTCommandTarget.Exec handled = False If executeOption = vsCommandExecOption.vsCommandExecOptionDoDefault Then If commandName = "MyFirstAddIn.Connect.MyFirstAddIn" Then Dim DTE As EnvDTE.DTE DTE = TryCast(System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.10.0"), EnvDTE.DTE) Dim strFullName As String = DTE.ActiveDocument.FullName handled = True Exit Sub End If End If End Sub
Set breakpoint on the start of method Exec.
When I launch project with Add-in there is opened new Visual Studio. I choice my test project, module ..\TestConsoleApplication\Module1.vb. And try in debug mode get current line from this module. But I have text from project of Add-in:
..\Visual Studio 2010\Projects\MyFirstAddInSolution\MyFirstAddIn\Connect.vb
What need change in method Exec for get value of strFullName like “..\TestConsoleApplication\Module1.vb” instead
“..\Visual Studio 2010\Projects\MyFirstAddInSolution\MyFirstAddIn\Connect.vb”
Thank for help.