Hi,
I have a VSPackage and I want to enumerate all the projects in the solution. To do this I use:
var dte = Package.GetGlobalService(typeof (SDTE)) as DTE;
for (var i = 1; i <= dte.Solution.Projects.Count; i++)
{
var project = dte.Solution.Projects.Item(i);
//do something here
}
This works well on simple solutions but if I have my solution organised into folders then I just get back a list of the folders.
For example, if the solution looks like this in solution explorer:
Solution.Sln
\Business
\ABC.proj
\DEF.proj
\ZX1.proj
\Data
\HIJ.proj
I will get back a project for \Business, \ZX1 and \Data (which aren't even projects) so it looks like the enumeration isn't projects but top level items in the solution.
Is this correct? Is there an easy way to get all projects or do I need to recurse down and get every project item?
ed