locked
Addin for VS210 - How open one file present in project programmatically and select some piece of code inside it RRS feed

  • Question

  • Hello all,

    I'm trying to develope one addin for VS2010.

    But I can't figure out how to solve that problem:

    I want to open in the Editor one file present in the solution programmatically and select some piece of code inside it.

    So I tried to investigate how the macro behave, recording the action corresponding, during one action that simulate my expected behaviour.

    I found that code:
    'DTE.ActiveWindow.Object.GetItem("projectname\sito").UIHierarchyItems.Expanded = True
    'DTE.ActiveWindow.Object.GetItem("projectname\sito\Files").UIHierarchyItems.Expanded = True
    'DTE.ActiveWindow.Object.GetItem("projectname\sito\Files\Queries").UIHierarchyItems.Expanded = True
    'DTE.ActiveWindow.Object.GetItem("projectname\sito\Files\Queries\Menu.xml").Select(vsUISelectionType.vsUISelectionTypeSelect)
    'DTE.ActiveWindow.Object.DoDefaultAction()


    First  I closed the macro recorder and I tried to run the macro, but nothing happened.

    Someone could kindly help me?

    My main purpose is to have that code working inside one VB.net Addin.

    Regards

    Mirko Ugolini

    Wednesday, April 4, 2012 10:12 AM

Answers

All replies