protected virtual List<IBuildDependencyOnProjectContainer> GetListOfProjectContainerNodes()
{
List<IBuildDependencyOnProjectContainer> projectList = new List<IBuildDependencyOnProjectContainer>();
Debug.Assert(this.Solution != null, "IVsSolution object not set on this object");
if(this.Solution == null)
{
// Bad state, so we quit
return projectList;
}
// Enum projects loaded in the solution (normal projects only)
IEnumHierarchies enumHierarchies = null;
Guid guid = Guid.Empty;
__VSENUMPROJFLAGS flags = __VSENUMPROJFLAGS.EPF_LOADEDINSOLUTION;
ErrorHandler.ThrowOnFailure(this.Solution.GetProjectEnum((uint)flags, ref guid, out enumHierarchies));
if(enumHierarchies != null)
{
// Loop projects found
IVsHierarchy[] hierarchy = new IVsHierarchy[1];
uint fetched = 0;
while(enumHierarchies.Next(1, hierarchy, out fetched) == VSConstants.S_OK && fetched == 1)
{
// If this is a ProjectContainerNode then add to list
IBuildDependencyOnProjectContainer projectNode = hierarchy[0] as IBuildDependencyOnProjectContainer;
if(projectNode != null)
{
projectList.Add(projectNode);
}
}
}
return projectList;
}