How do I programmatically list all of the projects in a solution? I\'ll take a script, command-line, or API calls.
Since Visual Studio 2013 the Microsoft.Build.dll provides a SolutionFile object with some very handy functions.
Here's an example of using the v14.0 version to list the relative path of all the projects in the order they appear in the solution.
Add-Type -Path (${env:ProgramFiles(x86)} + '\Reference Assemblies\Microsoft\MSBuild\v14.0\Microsoft.Build.dll')
$solutionFile = ''
$solution = [Microsoft.Build.Construction.SolutionFile] $solutionFile
($solution.ProjectsInOrder | Where-Object {$_.ProjectType -eq 'KnownToBeMSBuildFormat'}).RelativePath
There are plenty of other properties on the project object (ProjectName, AbsolutePath, configurations etc) that may be of use. In the above example I used the ProjectType to filter out Solution Folders.