Visual studio creates project files for you for the  various languages, such as C++, C#, VB. These files are XML format, and can thus be queried.

 

Try this: open any non-temporary Visual Studio project (see Use temporary projects in Visual Studio), right click on it in solution explorer, choose unload, then right click again, then choose edit. This opens the Proj file (.vbproj,.csproj) in the XML editor

 

I wanted a way to get just the References in a list, so I started to write an XLINQ query of the XML.

 

I kept getting no results, until I saw that the XML has a namespace that I didn’t notice at first:

 

<?xml version="1.0" encoding="utf-8"?>

<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

 

 

So I just needed to add an IMPORTS for the XML NameSpace

 

 

Imports <xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

 

Public Class Form1

    Dim sample = _

        <Reference Include="Microsoft.VisualStudio.CoreUtilityImplementation, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">

            <SpecificVersion>False</SpecificVersion>

            <HintPath>..\..\..\..\binaries\x86chk\bin\i386\Microsoft.VisualStudio.CoreUtilityImplementation.dll</HintPath>

        </Reference>

    Function trimcomma(ByVal s As String)

        'strip anything past comma     <Reference Include="somedllname, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">

        If s.IndexOf(",") > 0 Then

            Return s.Substring(0, s.IndexOf(","))

        End If

        Return s

    End Function

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        ' the path of the current project

        Dim xmlfile = My.Application.Info.DirectoryPath.Replace("\bin\Debug", "") + "\" + My.Application.Info.AssemblyName + ".vbproj"

        Dim xmlSrc = XDocument.Load(xmlfile)

        Me.Height = 800

        Me.Width = 1000

        Dim query = From a In xmlSrc...<Reference> _

                 Select r1 = trimcomma(a.@<Include>)

        For Each ref In query

            System.Diagnostics.Debug.WriteLine(ref)

        Next

 

        Dim lbx As New ListBox

        lbx.Width = Me.Width

        lbx.Height = Me.Height

        lbx.DataSource = query.ToArray

        Me.Controls.Add(lbx)

        lbx.Visible = True

 

    End Sub

End Class