BuildConsole for Visual Studio

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.

You can run a distributed job that uses one of the interfaces from the Incredibuild Interfaces extension package, using the IBConsole.exe command line interface. This interface is used to accelerate your custom tool, such as, rendering, simulations, QA testing, and scripts.

To operate BuildConsole.exe run:

BuildConsole <Target> [Options]

Where <Target> can be a path to a Visual Studio solution (.sln file) or 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 rebuild the Debug|Win64 solution configuration in the MySln.sln solution:

    BuildConsole.exe MySln.sln /rebuild /cfg="Debug|Win64"

  • To only build 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. 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.

If you get the error: BuildConsole is not recognized as an internal or external command, operable program or batch file., either manually add the Incredibuild installation folder to your system path, or rerun the Incredibuild setup application on your machine, making sure that the Add Incredibuild folder to the system path option is selected.

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.

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.

/buildcacheremoteserver=[ip address:port]

Use a different build cache endpoint from the one defined in the Agent settings. The port must also be specified. For example: /buildcacheremoteserver=192.5.8.1:50222

 

/buildcachelocal=[ON|OFF]

Override the setting that defines if local Build Cache is enabled on this Initiator.

 

/Cfg=<configuration>

Determines the solution configuration to be built. (With VC6 builds, this option specifies the project configuration.)

  • The value should be enclosed in quotes.

  • Several comma-separated configuration names can be specified.

  • The value is not case-sensitive.

/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.

  • Value may be surrounded by quotes.

  • Several source filenames may be entered, separated by commas.

/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.

/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"

/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:  8.1, 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: , 8.1, and 10.

/Mon[=filename]

Writes a copy of the build progress (.ib_mon) file to the specified location.

  • If only a folder name is given, Incredibuild generates a GUID for the file name. 

  • A message containing the location of the saved .ib_mon file is added to the end of the build output.

/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.

/NoLogo

Suppresses the "Incredibuild" header in the build output.

/NoRecurse

Builds only the specified project configurations, ignoring any sub-projects these configurations may have.

  • When used in conjunction with /Clean, this cleans only the specified configurations.

  • When used in conjunction with /Rebuild, this rebuilds only the specified configurations.

/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 and Agent's predictive execution setting.

/pemode=0 disables predictive execution

/pemode=2 fully enables predictive execution

/Preset

Determines the projects/configurations that will be built using a Preset previously saved in the Batch Build dialog.

  • This option is useful when a complex combination of projects and configurations is required.

  • The /Preset command option replaces both the /cfg and the /prj options.

/Prj=<project name>

Determines the project to be built.

  • The value may be enclosed in quotes.

  • Running BuildConsole on an .sln file without the /prj option will run the command on the specified solution configuration.

  • The "*" and "?" characters may be used as wildcard signs when specifying project names, to perform an operation on several projects.

  • Additionally, several project names may be entered, separated by commas. In this case, all projects are built using the same configuration name.

  • For example, to build all configurations in a solution/workspace, use the following syntax: BuildConsole MyWksp /prj="*"

/QueryLicense

Displays information regarding the active license, allocated packages, and maintenance expiration date.

/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. 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.

/UseCloudHelpers

When Cloud Helpers are enabled, this setting determines if they are used to assist in the current build. By default, the value is true. To prevent Cloud helpers from assisting in a build, set /UseCloudHelpers=false.

 

/UseEnv

Uses PATH, INCLUDE, LIBPATH, and LIB environment variables instead of MS Visual C++ IDE paths.

  • To set this option globally, use the Agent Settings dialog  box > Visual Studio Builds > AdvancedUse environment variables instead of IDE paths option.

  • If a build is initiated from a Visual Studio IDE window instantiated using the devenv.exe "/useenv" command line option, this build will always use "/useenv".

/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:

  • vc10 (for VS2010)

  • vc11 (for VS2012)

  • vc12 (for VS2013)

  • vc14 (for VS2015)

  • vc15 (for VS2017)

  • vc16 (for VS2019)

  • vc17 (for VS2022)

/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.

/EnableOlderMSVCSupport=True

To enable Build Cache with MSVC 2012-2015, set this flag to True.

This flag is false by default.

Return Codes

BuildConsole returns the following 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