List All Visual Studio Solution References with PowerShell

I recently needed to find which references in a rather large solution referenced specific projects and dlls in other areas of our codebase. The Gist below is a PowerShell script that will output a list of PowerShellCustomObjects with the following properties:

Output Object Properties:

  • ProjectPath (The location of the project file with the dependency)
  • ReferenceType (Either DLL or Project)
  • Name (The name of the dependency)


.\Get-VSSolutionReferences.ps1 [path\to\your\VSSolutionfile.sln]

Chances are, you’ll want to do some kind of aggregation on the output, below is an example of what you can do:

Important Note:

It is important to note that you’ll likely see duplicate dependencies because you’re seeing each dependency on each project of your solution. You can easily slim down the list by using PowerShell’s grouping and filtering.

The Gist:

Leave a Reply

Your email address will not be published. Required fields are marked *