I saw this question on a newsgroup: How do you access the properties of a project via the EnvDTE VS extensibility interface? It’s really quite simple, like in this code:
Sub AccessProject() Dim proj As Project proj = DTE.Solution.Projects.Item(1) Dim prop As [Property] For Each prop In proj.Properties Debug.Print("Project property " & prop.Name & " = " & prop.Value) Next Dim projItem As ProjectItem For Each projItem In proj.ProjectItems Debug.Print("Project item " & projItem.Name) Next End Sub
This will simply print out all the project properties and items it finds. The sample accesses only the first entry in the solution’s Projects list - you can directly access other specific members in a similar way, of course, and it’s also possible to find the currently active project(s) via the
Dim projects as System.Array = DTE.ActiveSolutionProjects Dim proj as Project For Each proj In projects Debug.Print(proj.Name) Next
Sorry, this blog does not support comments. Why not?
I used various blog hosting services since this blog was established in 2005, but unfortunately they turned out to be unreliable in the long term and comment threads were lost in unavoidable transitions. At this time I don't want to enable third-party services for comments since it has become obvious in recent years that these providers invariably monetize information about their visitors and users.
Please use the links in the page footer to get in touch with me. I'm available for conversations on Keybase, Matrix, Mastodon or Twitter, as well as via email.