Joel in Gö
Joel in Gö

Reputation: 7570

Easiest way to build many solutions at once in Visual Studio 2008

Is there a simple and straightforward way to build many VS2008 solutions in a batch? I would like to build over 50 at once as Release, and perhaps also as Debug builds.

The trouble with just using MSBuild on the command line is that it is very difficult to find out which solutions/projects failed to build, information which is essential. Does anyone have a good suggestion?

Upvotes: 1

Views: 446

Answers (3)

Burkhard Exner
Burkhard Exner

Reputation: 46

You can call devenv (Visual Studio) from a batch file to build your project, for instance:

  devenv projectfile /rebuild release /out logfile

This will run quietly without showing the IDE. The logfile will receive the messages you normally see in the output window building from within the VS-IDE.

Returncode is 0 if the build is ok, otherwise 1.

Here is a list of all devenv command line switches

Upvotes: 1

Ludwo
Ludwo

Reputation: 6173

You can build all solutions using MSBuild script and specify different log files for errors or warnings only or full diagnostic log. You can use up to ten file loggers.

Define MSBuild script for building your solutions. Add all your solution files in ProjectToBuild item collection:

 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <ItemGroup>
        <ProjectToBuild Include="a1.sln…">
            <Properties>Configuration=Debug</Properties>
        </ProjectToBuild>
        <ProjectToBuild Include="a2.sln">
            <Properties>Configuration=Release</Properties>
        </ProjectToBuild>
    </ItemGroup>
    <Target Name="Build">
        <MSBuild Projects="@(ProjectToBuild)"/>
    </Target>
</Project>

Use /flp MSBuild command line argument to specify different log files for errors, warning, and full diagnostic log.

msbuild.exe ScriptAbove.proj /filelogger /flp1:logfile=errors.txt;errorsonly /flp2:logfile=warnings.txt;warningsonly /flp3:LogFile=FullDiagnostic.log;Verbosity=diagnostic

Upvotes: 2

Oded
Oded

Reputation: 498904

You can call MSBuild for each solution in a batch file, redirecting the output to a file, so you can see what failed.

Upvotes: 0

Related Questions