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.Project.CodeModel doesn't retrieve attributes in the AssemblyInfo file

Author: Carlos J. Quintero (Microsoft MVP) Applies to: Microsoft Visual Studio .NET 2002
Date: July 2009   Microsoft Visual Studio .NET 2003
      Microsoft Visual Studio 2005
      Microsoft Visual Studio 2008

Introduction

When you iterate the code elements of a project code model using EnvDTE.Project.CodeModel.CodeElements, the attributes in the AssemblyInfo are not retrieved.

This happens with C# projects in all Visual Studio versions and with VB.NET projects in Visual Studio .NET 2002/2003. It works fine with VB.NET projects in Visual Studio 2005 and higher.

More Information

Steps to reproduce the problem:

  • Create a Class Library project.
  • Create and run the following macro, which shows the attributes in the code model:
Language: VB.NET   Copy Code Copy Code (IE only)
   Sub GetCodeElements()

      GetCodeElements(DTE.Solution.Projects.Item(1).CodeModel.CodeElements)

   End Sub

   Sub GetCodeElements(ByVal codeElements As CodeElements)

      For Each codeElement As CodeElement In codeElements

         Select codeElement.Kind

            Case vsCMElement.vsCMElementNamespace

               GetCodeElements(CType(codeElement, CodeNamespace).Members)

            Case vsCMElement.vsCMElementAttribute

               MessageBox.Show(codeElement.FullName)

         End Select

      Next

   End Sub

As a workaround, you can locate the AssemblyInfo file and use its EnvDTE.ProjectItem.FileCodeModel.

Related articles


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