Ver versión en español    
 
Home
10 Reasons to use MZ-Tools
MZ-Tools 6.0 for VS.NET
Editions
Features
Online Documentation
MZ-Tools SDK
Download
Purchase
Version History (RSS)  
FAQ & Support
MZ-Tools 3.0 for VB6 & VBA
Features
Online Documentation
Download (freeware)
Donations (Paypal)
Version History (RSS)  
FAQ & Support
User Reviews
Community Place
Contact  
For Add-In Developers
About
   
 
User Testimonials

I'm an avid supporter of MZ-Tools. It's a product I couldn't do without and your level of support is outstanding.

Jan Hyde (Visual Basic MVP)

You will soon wonder how you ever lived without it.

Andy Maggs

More user reviews
 
BUG: EnvDTE.UIHierarchyItems does not work correctly in Visual Studio 2005 if Solution Explorer nodes are not opened previously

Author: Carlos J. Quintero (Microsoft MVP) Applies to: Microsoft Visual Studio 2005
Date: April 2007    
       
Introduction

When using a macro or add-in in VS 2005 to iterate the nodes of the Solution Explorer, some nodes inside solution folders are not returned if you didn't expand them previously by hand.

Cause

This seems to be a bug of Visual Studio 2005.

More Information

Steps to reproduce the problem:

  • Create a macro like the following, which iterates recursively the nodes of the solution explorer:
    Sub NavigateSolutionExplorerHierarchy()
        NavigateUIHierarchyItems(DTE.ToolWindows.SolutionExplorer.UIHierarchyItems)
    End Sub
    Private Sub NavigateUIHierarchyItems(ByVal colUIHierarchyItems As UIHierarchyItems)
        For Each objUIHierarchyItem As UIHierarchyItem In colUIHierarchyItems
            System.Windows.Forms.MessageBox.Show(objUIHierarchyItem.Name)
            NavigateUIHierarchyItems(objUIHierarchyItem.UIHierarchyItems)
        Next
    End Sub
  • Create a blank solution in Visual Studio 2005 ("Other Project Types", "Visual Studio Solutions").
  • Add to the solution a solution folder (such as "NewFolder1").
  • Add to the solution folder a child solution folder (such as "NewFolder11").
  • Add a project (such as "ClassLibrary1") to the child solution folder ("NewFolder11").
  • Collapse the child solution folder ("NewFolder11") in the Solution Explorer.
  • Collapse the solution folder ("NewFolder1") in the Solution Explorer.
  • Close the solution (saving the changes).
  • Open the solution again. The nodes in the Solution Explorer are collapsed.
  • Run the macro. Notice that the project node ("ClassLibrary1") is not listed.
  • Expand all the nodes in the Solution Explorer.
  • Run the macro again. This time the project node ("ClassLibrary1") is listed.

Go back to the 'Resources for Visual Studio .NET extensibility' section for more articles like this


MZ-Tools 6.0 for Visual Studio .NET

You can code, design, locate code and document your apps much faster using VB.NET, C#, C++ or Visual J#:

Buy MZ-Tools Now Download MZ-Tools Demo

   Top