Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I programmatically list all projects in a solution?

How do I programmatically list all of the projects in a solution? I'll take a script, command-line, or API calls.

like image 238
Kiquenet Avatar asked Sep 27 '10 08:09

Kiquenet


People also ask

Who displays the list of projects contained in current solution?

1. Who displays the list of projects contained in current solution? Clarification: The Solution Explorer Window provides you with an organized view of your projects and their files as well as ready access to the commands that pertain to them.

How many projects are in a solution?

Some authors propose a number between 15-20 maximum projects in a Visual Studio Solution to be a good compromise.

How do you include a project in a solution?

In Solution Explorer, select the solution. On the File menu, point to Add, and click Existing Project. In the Add Existing Project dialog box, locate the project you want to add, select the project file, and then click Open. The project is added to the selected solution.

How do I add a Csproj to a solution?

Adding a project to a solution file Once you have a solution file, you can add a project to it using the sln add command, and provide the path to the project's . csproj file. This will add the project to an existing solution file in the current folder.


1 Answers

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]       }     } 
like image 110
brianpeiris Avatar answered Sep 27 '22 17:09

brianpeiris