How do I programmatically list all of the projects in a solution? I'll take a script, command-line, or API calls.
Here's a PowerShell script that retrieves project details from a .sln file:
Get-Content 'Foo.sln' |
Select-String 'Project\(' |
ForEach-Object {
$projectParts = $_ -Split '[,=]' | ForEach-Object { $_.Trim('[ "{}]') };
New-Object PSObject -Property @{
Name = $projectParts[1];
File = $projectParts[2];
Guid = $projectParts[3]
}
}