Running Visual Studio in the Command Line
BuildConsole.exe, located in the Incredibuild installation folder, is a console application that enables you to run distributed Visual Studio builds from the command line.
To operate BuildConsole.exe run:
BuildConsole <Target> [Options]
Where <Target> can be any of the following:
-
A path to a Visual Studio solution (.sln file)
-
A path to a Visual Studio project (.vcproj/.icproj/.vcxproj file)
The BuildConsole command doesn’t force you to include the .sln file as part of the build command in order to build specific projects. However, omitting the .sln parameter is not recommended. Some of the information Incredibuild may require in order to correctly compile the project may be missing from the project file. A flag /VsVersion was added to Incredibuild's BuildConsole command that allows you to specify the Visual Studio version with which Incredibuild builds the projects.
Examples:
-
To rebuild the Debug|Win32 solution configuration in the MySln.sln solution:
BuildConsole.exe MySln.sln /rebuild /cfg="Debug|Win32"
-
To build only the Proj1 project in the MySln.sln solution, in both Debug|Win32 and Release|Win32 solution configurations:
BuildConsole.exe MySln.sln /build /prj=Proj1 /cfg="Debug|Win32,Release|Win32"
-
To build a more complex combination of projects and configurations, using a MyPreset preset previously saved in the Batch Build dialog:
BuildConsole.exe MySln.sln /build /preset="MyPreset"
In addition to this syntax, BuildConsole also supports msdev.exe and devenv.exe command line syntax for building projects. If you are already using batch files that spawn either msdev.exe or devenv.exe, replace the standard MSVC build with an Incredibuild distributed build, by editing your files and replacing these program names with BuildConsole.exe.
Only one build at a time can be executed on a single initiating machine unless you have an Incredibuild Enterprise Account. Otherwise, an attempt to run a build while another is running, pauses the build until the currently running build ends. Only then, does the new build begin to run.
Command Line Options
Option | Function | Notes |
---|---|---|
@ |
Specifies a response file containing a BuildConsole command line. |
Use this option when the command line for running BuildConsole is too long to specify explicitly in your script. |
/All |
Causes a solution/workspace build to continue, regardless of specific projects failing to build. |
By default, Incredibuild stops the build when a project fails to build its output file. This option instructs Incredibuild to continue building the remaining project configurations, regardless of previous projects failing to build. |
/Attach |
Displays the build output of either the current or the last build. |
If a build is currently running on the machine, this displays the output for the build up to that point, and continues displaying the build's output until it ends. If no build is running, BuildConsole displays the entire build output for the last build initiated from this machine. |
/AvoidLocal=[On/Off] |
Overrides the Avoid task execution on local machine when possible option in the Agent Settings dialog box. |
A value (either ON or OFF) is mandatory. |
/Beep |
Plays a sound when the build is complete. |
|
/BrowseInfo=[ON/OFF] |
Forces or suppresses creation of browse information, regardless of current browse information settings. |
See Agent Settings for more information regarding browse information settings. |
/CEconfig="<configuration name>" |
Specifies the WCE platform for eMbedded Visual C++ 4.0 builds. |
For VS 2008 and prior. |
/Cfg=<configuration> |
Determines the solution configuration to be built. (With VC6 builds, this option specifies the project configuration.) |
|
/cl_add="<options>" |
Allows additional compiler options to be added to all calls to cl.exe. |
Enter one or more commands separated by a space character, as they would appear in the cl.exe command line. For example: BuildConsole MyProj /cl_add="/O2 /FA" |
/cl_rem="<options>" |
Specifies compiler options that will be removed from all calls to cl.exe. |
Enter one or more commands separated by a space character, as they would appear in the cl.exe command line. For example: BuildConsole MyProj /cl_rem="/Z7 /Zd /Zi /ZI" |
/Clean |
Cleans intermediate and output files for the project(s) and all dependencies. |
|
/compile=<source file name> |
When used, only the specified file(s) are built. |
|
/Disable |
Disables Incredibuild Agent. |
|
/DisablePdbForwarding |
Disables the PDB forwarding mechanism for this build. |
Only relevant for Visual Studio 2010 builds. |
/DumpSourceFiles=filename |
Writes all of the source file paths in a project/solution to a file. |
<output filename> is mandatory. |
/Enable |
Enables Incredibuild Agent. |
|
/Help |
Shows usage help and version information. |
|
/IncrediLink |
Forces IncrediLink mode for this build. |
For VS 2008 and prior. |
/IntelCLVersion="<version>" |
Overrides the default Intel Compiler version. |
For VS 2008 and prior. For example: /IntelCLVersion=11.1 |
/link_add="<options>" |
Allows additional linker options to be added to all calls to link.exe. |
Enter one or more commands separated by a space character, as they would appear in the cl.exe command line. For example: BuildConsole MyProj /link_add="/map:MyProj.map" |
/link_rem="<options>" |
Specifies linker options that will be removed from all calls to link.exe. |
For VS 2008 and prior. Enter one or more commands separated by a space character, as they would appear in the cl.exe command line. For example: BuildConsole MyProj /link_rem="/map:MyProj.map" |
/Log[=filename] |
Writes build output to a file. |
If filename is omitted, a file named IB_<target-name>.log is created in the current directory. |
/LogLevel="<Level>" |
Overrides the logging level for this build. |
<Level> can be one of the following: Minimal, Basic, Intermediate, Extended, Detailed. |
/MaxCPUS=<n> |
Overrides global maximum CPUs/Cores in build setting. |
|
/MaxWinVer="<Version>" |
Specifies the maximal operating system required by remote Agents assigned to this build. |
Agents with a newer OS are not assigned to the build. Available values are: XP, 2003, VISTA, 2008, 7, and 10. |
/MinWinVer="<Version>" |
Specifies the minimal operating system required by remote Agents assigned to this build. |
Agents with an older OS are not assigned to the build. Available values are: XP, 2003, VISTA, 2008, 7, 8, and 10. |
/Mon[=filename] |
Writes a copy of the build progress (.ib_mon) file to the specified location. |
|
/msbuildargs="/myarg1 /myarg2" |
Passes additional arguments to MSBuild, when using the BuildConsole /command /usemsbuild switch. |
For example: BuildConsole dcom.sln /rebuild /cfg="debug|win32" /msbuildargs="/detailedsummary" /usemsbuild |
/NO_DOTNET_VIRT |
Disables the virtualization of .NET environment on Helper machines. |
When this switch is specified in the command line, it instructs Incredibuild not to virtualize the .NET environment of the Initiator machine to the Helper machines. This switch was added to address .NET incompatibilities in a mixed OS environment. |
/NoIncrediLink |
Disables IncrediLink mode for this build. |
For VS 2008 and prior. |
/NoLink |
Performs all build steps except linking. |
For VS 2008 and prior. |
/NoLogo |
Suppresses the "Incredibuild" header in the build output. |
|
/NoRecurse |
Builds only the specified project configurations, ignoring any sub-projects these configurations may have. |
|
/NoWait |
When specified, if another build initiated by this Agent is already running, BuildConsole exits with a Another build already running message. |
|
/OpenMonitor |
Opens the Build Monitor window showing the build progress. |
|
/out=filename |
Redirects entire command line output to a file. |
|
/pemode |
Overrides an Agent's predictive execution setting. |
/pemode=0 disables predictive execution /pemode=2 fully enables predictive execution /pemode=1 enables predictive execution for rebuilds only |
/Preset |
Determines the projects/configurations that will be built using a Preset previously saved in the Batch Build dialog. |
|
/Prj=<project name> |
Determines the project to be built. |
|
/QueryLicense |
Displays information regarding the active license, allocated packages, and maintenance expiration date. |
|
/QueryPackage="<Package>" |
Checks whether a specific Incredibuild extension package is allocated to the Agent, and sets exit code to 0 (allocated) or 1 (not allocated). |
<Package> can be VC, C#, BuildTools, DevToolAcc, XGE, Xbox One, PlayStation, Cafe, 3DS, KlocWorkPro or Coverity. In addition, the following cores packages are supported: 4Cores, 8Cores, 12Cores, 16Cores, 24Cores, 32Cores, 48Cores and 64Cores. |
/Rebuild |
Performs a Clean operation before building the project. |
Use /SETENV several times to set/override multiple variables. |
/Reset |
Clears the Agent file cache content. |
|
/SETENV="<name>=<value>" |
Sets or overrides environment variables for the context of the run build. |
|
/ShowAgent |
Shows the Agent used to build each file. |
|
/ShowCmd |
Shows for each file built, the command-line used by Incredibuild to build the file. |
|
/ShowTime |
Shows the Start and Finish time for each file built. |
|
/Silent |
Does not write anything to the standard output. |
The default behavior is to write the build results, as seen in the Output display of the Build Monitor. |
/Stop[=<build-id>] | Stops a currently running build on the local machine. Provide <build-id> if more than one build is running. | IBConsole returns the code 3 when a build has been stopped. If /stop was used and no build is currently running, code 2 is returned. |
/StopOnErrors | When specified, the execution will stop as soon as an error is encountered. | |
/StopAll |
Stops all currently running builds |
|
/Title=<build title> |
Specifies a custom header line which will be displayed in the beginning of the build output text. This title will also be used for the Build History and Build Monitor displays. |
Value may be surrounded by quotes. |
/UseEnv |
Uses PATH, INCLUDE, LIBPATH, and LIB environment variables instead of MS Visual C++ IDE paths. |
|
/UseIDEMonitor |
When BuildConsole is run from the Visual Studio IDE with this option, the integrated IDE Build Monitor displays the build progress. |
|
/UseMSBuild |
Forces the usage of MSBuild. |
By default, Incredibuild uses Devenv to perform the build. Using this switch, Incredibuild will use MSBuild which will enable the option to add specific MSBuild flag using the /msbuildargs as can be seen below. This will automatically use the 64 bit MSBuild for VS 2022 and later, and the 32 bit MSBuild for earlier VS versions. To ignore this automatic detection and manually specify which version to use, add =32 or =64 (e.g. /usemsbuild=32) |
/VsVersion="<Version>" |
Forces a specific version of Visual Studio toolset to be used. |
<Version> can be one of the following: vc8 (for VS2005), vc9 (for VS2008), vc10 (for VS2010), vc11 (for VS2012), vc12 (for VS2013), vc14 (for VS2015), vc15 (for VS2017), and vc16 (for VS2019). |
/Wait |
If another build initiated by this Agent is currently running, waits until that build is finished and then starts the new build. This is also the default behavior. |
Return Codes
-
0 – Build succeeded with no errors
-
1 – Build failed due to error not related to Incredibuild (e.g. compilation error)
-
2 –Build cancelled by user request
-
3 – Build failed due to Incredibuild system error