无法在 VSLangProj 中定位 VSProject 接口

Unable to locate VSProject interface in VSLangProj

编辑:注意:我使用的是 Visual Studio 2015

我正在尝试使用 VSIX 项目编写一个 VisualStudio 扩展,它提供当前加载的解决方案的所有引用。

我可以使用下面的代码获取当前解决方案和其中的项目(实际上是所有项目)。

我将有问题的代码分离到 GetProjectReferences 方法。
我无法参考 VSLangProj.VSProject.

 DTE2 dte2 = Package.GetGlobalService(typeof(DTE)) as     
 var sol = dte2.Solution;
 var projs = sol.Projects;

 foreach (Project project in projs)
 {
     if (project.Kind == ProjectKinds.vsProjectKindSolutionFolder)
     {   
         //Ignoring Solution Folders for now
     }
     else
     {
         //This method tries to get the refernces
         AppendProject(sb,project);
     }               
 }

 private void GetProjectReferences(StringBuilder sb, Project project)
    {            
        var vsProject = project.Object as VSLangProj.VSProject;
        var references = vsProject.References as VSLangProj.References;
        sb.AppendLine(project.Name + ": " + references.Count);
        int counter = 1;
        foreach (var reference in references)
        {
            sb.AppendLine((counter++)+": " + reference.Name + " (" + reference.Path +")");
        }
    }

它与微软的文档不匹配,我无法在此处提到的任何其他微软库(VSLangProj2VSLangProj80)中找到此接口: https://msdn.microsoft.com/en-us/library/vslangproj.aspx

我也试过用VB来测试这里的代码,没有用: https://msdn.microsoft.com/en-us/library/vslangproj.vsproject.aspx

' Macro Editor
' This example retrieves the VSProject object if the first project
' the solution is a Visual Basic or C# project. This routine assumes
' that the solution contains at least one project.
Imports VSLangProj
Sub VSProjectExample()
   Dim aProject As Project
   Dim aVSProject As VSProject

   aProject = DTE.Solution.Projects.Item(1)
   If (aProject.Kind = PrjKind.prjKindVBProject) _
   Or (aProject.Kind = PrjKind.prjKindCSharpProject) Then
      aVSProject = CType(DTE.Solution.Projects.Item(1).Object, VSProject)
      MsgBox(aVSProject.Project.FullName)
   Else
      MsgBox("The first project is not a Visual Basic or C# project.")
   End If
End Sub

感谢@ErikEJ,我找到了缺失的部分:我没有 VSLangProj 参考。 它位于 Reference Manager

Extensions 选项卡中