How to: Run Multiprocessor Builds with DEVENV Command Line Switches

Use the DEVENV command-line tool and its command-line switches to perform multiprocessor builds. To enable multiprocessor builds, the default or modified value of the maximum number of parallel project builds property must be greater than 1. For more information, see How to: Set the Number of Concurrent Builds for Multiprocessor Builds.

When multiprocessor builds are enabled for DEVENV command-line switches, they will automatically run when you invoke DEVENV by using the following build options:

To run multiprocessor builds by using DEVENV command-line switches

  1. Open a command window.

    Note

    To set the appropriate environment variables to run Visual Studio tools in a command session, you may have to run VSVARS32.BAT or VCVARS32.BAT.

  2. At the command prompt, type the following command line to build your solution:

    devenv solution**.sln** [options] solution-config [/project project-name-or-file [/projectconfig name]]

    The solution placeholder specifies the name, or path and name, of the solution file.

Example

The following example illustrates a multiprocessor build from the DEVENV command-line tool. The example uses a solution named MultiprocExample that consists of three C++ console application projects named ConsoleApp1, ConsoleApp2, and ConsoleApp3. Then the example uses the following command line to run a multiprocessor rebuild of the Debug configuration of the solution.

C:\>devenv "C:\Users\my_user_name\Documents\Visual Studio 2010\Projects\MultiprocExample\MultiprocExample.sln" /rebuild Debug
...
Copyright (C) Microsoft Corp. All rights reserved.
1>------ Rebuild All started: Project: ConsoleApp2, Configuration: Debug Win32 ------
2>------ Rebuild All started: Project: ConsoleApp1, Configuration: Debug Win32 ------
2>Build started 3/26/2010 5:42:21 PM.
1>Build started 3/26/2010 5:42:21 PM.
1>_PrepareForClean:
1>  Deleting file "Debug\ConsoleApp2.lastbuildstate".
2>_PrepareForClean:
2>  Deleting file "Debug\ConsoleApp1.lastbuildstate".
1>InitializeBuildStatus:
1>  Creating "Debug\ConsoleApp2.unsuccessfulbuild" because "AlwaysCreate" was specified.
2>InitializeBuildStatus:
2>  Creating "Debug\ConsoleApp1.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>ClCompile:
1>  stdafx.cpp
2>ClCompile:
2>  stdafx.cpp
2>  ConsoleApp1.cpp
1>  ConsoleApp2.cpp
2>Manifest:
2>  Deleting file "Debug\ConsoleApp1.exe.embed.manifest".
1>Manifest:
1>  Deleting file "Debug\ConsoleApp2.exe.embed.manifest".
2>LinkEmbedManifest:
2>  ConsoleApp1.vcxproj -> C:\Users\my_user_name\Documents\Visual Studio 2010\Projects\MultiprocExample\Debug\ConsoleApp1.exe
2>FinalizeBuildStatus:
2>  Deleting file "Debug\ConsoleApp1.unsuccessfulbuild".
2>  Touching "Debug\ConsoleApp1.lastbuildstate".
2>
2>Build succeeded.
2>
2>Time Elapsed 00:00:01.43
1>LinkEmbedManifest:
1>  ConsoleApp2.vcxproj -> C:\Users\my_user_name\Documents\Visual Studio 2010\Projects\MultiprocExample\Debug\ConsoleApp2.exe
1>FinalizeBuildStatus:
1>  Deleting file "Debug\ConsoleApp2.unsuccessfulbuild".
1>  Touching "Debug\ConsoleApp2.lastbuildstate".
1>
1>Build succeeded.
1>
1>Time Elapsed 00:00:01.45
3>------ Rebuild All started: Project: ConsoleApp3, Configuration: Debug Win32 ------
3>Build started 3/26/2010 5:42:22 PM.
3>_PrepareForClean:
3>  Deleting file "Debug\ConsoleApp3.lastbuildstate".
3>InitializeBuildStatus:
3>  Creating "Debug\ConsoleApp3.unsuccessfulbuild" because "AlwaysCreate" was specified.
3>ClCompile:
3>  stdafx.cpp
3>  ConsoleApp3.cpp
3>Manifest:
3>  Deleting file "Debug\ConsoleApp3.exe.embed.manifest".
3>LinkEmbedManifest:
3>  ConsoleApp3.vcxproj -> C:\Users\my_user_name\Documents\Visual Studio 2010\Projects\MultiprocExample\Debug\ConsoleApp3.exe
3>FinalizeBuildStatus:
3>  Deleting file "Debug\ConsoleApp3.unsuccessfulbuild".
3>  Touching "Debug\ConsoleApp3.lastbuildstate".
3>
3>Build succeeded.
3>
3>Time Elapsed 00:00:00.83
========== Rebuild All: 3 succeeded, 0 failed, 0 skipped ==========

See Also

Tasks

How to: Run Multiprocessor Builds in the IDE