text: Q:
  
  Get type information from assemblies in current solution from VS2010 extension
  
  I'm building a command extension for the UML Sequence Diagram in VS2010, and need a list of types that implement a particular interface in the current solution. How do you access type and assembly information from an extension? So far all of my attempts have just listed assemblies loaded in the original extension project, not the one that VS is currently editing.
  
  A:
  
  Here's the solution I finally arrived at, using linq to simplify the search:
  DTE dte = (DTE)ServiceProvider.GetService(typeof(DTE));
  var types = from Project project in dte.Solution.Projects
              from Reference reference in (References)project.Object.References
              where reference.Type == prjReferenceType.prjReferenceTypeAssembly
              from t in Assembly.LoadFile(reference.Path).GetTypes()
              where t != typeof(IInterface) && typeof(IInterface).IsAssignableFrom(t)
              select t;
  
  This block searches through all projects contained in the currently open solution, gets all of their references, loads the ones which are assemblies, and searches them for types that implement the interface.
  
  