private bool IsReferenceInCycle(Guid projectGuid) { // use same logic as C#: // vsproject\langbuild\langref.cpp // BOOL CLanguageReferences::IsCircularReference(CLangReference *pclref, BOOL fCalculateDependencies) int isCircular = 0; IVsHierarchy otherHier = VsShellUtilities.GetHierarchy(this.ProjectMgr.Site, projectGuid); IVsSolutionBuildManager2 vsSBM = this.ProjectMgr.GetService(typeof(SVsSolutionBuildManager)) as IVsSolutionBuildManager2; vsSBM.CalculateProjectDependencies(); vsSBM.QueryProjectDependency(otherHier, this.ProjectMgr.InteropSafeIVsHierarchy, out isCircular); return(isCircular != 0); }