xyz
xyz

Reputation: 782

How to build all projects of all solutions in a folder?

How to build all projects of all solutions in a folder?Creating a new solution with all projects is not feasible for me as I have to add all the dependent projects for each project from "Project Dependencies..." or "Project build order" and I have 150 projects in 30 solutions and project build order is to be maintained for me to build successfully.

Upvotes: 1

Views: 5527

Answers (2)

Mari Faleiros
Mari Faleiros

Reputation: 738

Just adding my two cents:

I'm using Visual Studio 2015 so I ran "Developer Command Prompt for VS2015" (which exists for every respective version of VS afaik).

Then, I navigated to the root directory of all my solutions I needed to build using Debug configuration and, finally, I executed the following command:

for /r %x in (*.sln) do devenv %x /build Debug

Upvotes: 3

Martin Ullrich
Martin Ullrich

Reputation: 100791

This can be done using a custom msbuild script. Since you want to preserve the project dependencies within each solution, the remaining option is to find and build all solution files in the directory hierarchy.

When you create a file buildAllSlns.proj with the following content:

<Project DefaultTargets="Build">
  <ItemGroup>
    <Solution Include="**\*.sln" />
  </ItemGroup>
  <Target Name="Build">
    <MSBuild Projects="@(Solution)" Targets="Build" Properties="Configuration=Release" />
  </Target>
</Project>

It can be run by calling

msbuild buildAllSlns.proj

Upvotes: 1

Related Questions