Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

My first Add-in for Visual Studio. How debug active document in test project.

$
0
0

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\Co­nnect.vb

What need change in method Exec for get value of strFullName like “..\TestConsoleApplication\Module1.vb” instead

“..\Visual Studio 2010\Projects\MyFirstAddInSolution\MyFirstAddIn\Co­nnect.vb”

Thank for help.



Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>