HowTo get all interfaces types from visual studio solution?
Asked Answered
A

0

3

I'm trying to write an extension to visual studio.

I need to get a list of all the interfaces types found in all the projects in the current opened solution.
So far i have tried doing this using the EnvDev namespace.

Is there a way of doing this without parsing the project's .cs files ?

Thanks,

Chai.

Archlute answered 24/10, 2012 at 14:33 Comment(6)
EnvDTE is the way to do it....can you clarify what you have tried and why it didn't work for you?Empedocles
@Jason Please look at the related question: How to collect types from current solution?Dolora
I found some sample code in related topic Finding a ProjectItem by type name via DTE But this iterative approach is very, very slow. In my VS solution with about 60 projects this code is executed a dozen or so seconds, therefore it is not acceptable solution. I guess it's time consuming operation, but I believe there is a faster way to reach a goal. Resharper and it's types collecting module does this job faster during initialization.Dolora
There is no faster way with standard VS APIs. Resharper is able to do it because they go parse all the .cs files themselves. Once Roslyn replaces the Visual Studio language services, it would become the way to do this which is quite, quite fast. :-)Empedocles
You should possibly look in R# (Resharper sdk) and build a plugin on top of itFrankforter
Have you tried the project.CodeModels instead of going after all the ProjectItem.FileCodeModels? Could be a bit faster in your case.Immobilize

© 2022 - 2024 — McMap. All rights reserved.