FPGA
FPGA

Reputation: 3875

Visual studio solution adding multiple projects

I have 31 projects, each is inside a folder and i have an empty visual studio solution, is there a way to add all projects in the folder to my solution without having to add them one by one?

Upvotes: 3

Views: 2098

Answers (1)

Richard Szalay
Richard Szalay

Reputation: 84804

Assuming you have NuGet installed, you can do this via the Package Manager Console (Tools :: Library Package Manager :: Package Manager Console) using the following:

$sln = Get-Interface $dte.Solution ([EnvDTE80.Solution2])
Get-ChildItem -Recurse *.csproj | %{ $sln.AddFromFile($_.FullName) }

Replace csproj with vbproj if you are using VB.NET.

Edit To clarify: as Dave points out, the reason this is possible via a seemingly unrelated tool is that the PMC exposes a Powershell interface with support for the Visual Studio APIs already configured, making it the simplest way to "script" against the IDE.

Upvotes: 15

Related Questions