Assuming that we have a bigger Microsoft .NET project that has a structure like this:

ROOT
  -- SubProject1
  -- SubProject1\SubProject1.sln
  -- SubProject1.Tests
  -- SubProject1.Tests\SubProject1.Tests.csproj
  -- SubProject2
  -- SubProject2\SubProject1.sln
  -- SubProject2.Tests
  -- SubProject2.Tests\SubProject2.Tests.csproj
  -- SubProject3
  -- SubProject3\SubProject1.sln
  -- SubProject3.Tests
  -- SubProject3.Tests\SubProject2.Tests.csproj

we can build it at once using MSBuild. Lets create a builder.proj file

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
<ItemGroup>
	<Solution Include="**\*.sln" />
</ItemGroup>
<ItemGroup>
	<TestAssemblies Include="**\**\bin\**\*Tests.dll"/>
</ItemGroup>
<Target Name="Build">
  <MSBuild Projects="@(Solution)" Targets="Build"/>
</Target>
<Target Name="Test">
  <Exec Condition=" '@(TestAssemblies)' != ''"
          Command="Mstest.exe /resultsfile:results.trx @(TestAssemblies ->'/testcontainer:"%(RecursiveDir)%(Filename)%(Extension)"', ' ')"
          ContinueOnError="true" IgnoreExitCode="true" />
</Target>
</Project>

and then we can execute

msbuild /t:Build builder.proj -- building the project
msuilbd /t:Test builder.proj -- running all tests

References