Visual Studio Command Line

Visual-studio command-line visual-studio-2010. Improve this question. Follow edited May 5 '10 at 17:10. Asked May 5 '10 at 16:15. These Visual Studio code hotkeys are useful for removing the syntax of the comment from the prevailing line or currently marked lines of code. For example, if you are using the code editor and you want to remove the already written syntax of comments then Ctrl-K comes under the text manipulation Visual Studio keyboard shortcuts. Mar 25, 2021 Visual Studio includes a command-line C and C compiler. You can use it to create everything from basic console apps to Universal Windows Platform apps, Desktop apps, device drivers, and.NET components. In this walkthrough, you create a basic, 'Hello, World'-style C program by using a text editor, and then compile it on the command line. Aug 02, 2021 To open a developer command prompt window On the desktop, open the Windows Start menu, and then scroll to find and open the folder for your version of Visual. In the folder, choose the Developer Command Prompt for your version of Visual Studio. This shortcut starts a developer.

-->

When you install Visual Studio programmatically or from a command prompt, you can use a variety of command-line parameters to control or customize the installation to perform the following actions:

  • Start the installation on the client with certain options and behaviors preselected.
  • Automate the installation process.
  • Create or maintain a network layout of the product files for installing or updating client machines.

The command-line options can be used with either the setup bootstrapper, which is the small (~1 MB) file that initiates the download process, or the administrator update package, which is deployed to the Microsoft Update Catalog.

To get the bootstrapper for Visual Studio 2017 version 15.9, go to the Visual Studio previous versions page and download one of the following bootstrapper files:

EditionFilename
Visual Studio Enterprise 2017 version 15.9vs_enterprise.exe
Visual Studio Professional 2017 version 15.9vs_professional.exe
Visual Studio Build Tools 2017 version 15.9vs_buildtools.exe

You can get the Visual Studio 2019 bootstrapper from either the Visual Studio downloads page or the Visual Studio 2019 Releases page for your chosen version and edition of Visual Studio. Your setup file --or bootstrapper-- will match or be similar to one of the following:

EditionFile
Visual Studio 2019 Enterprisevs_enterprise.exe
Visual Studio 2019 Professionalvs_professional.exe
Visual Studio 2019 Build Toolsvs_buildtools.exe
Visual Studio 2019 Communityvs_community.exe
Visual Studio Command Line

Tip

Released versions of Visual Studio 2022 are not yet available, the bootstrappers below are for the preview release of Visual Studio 2022.Start by downloading the Visual Studio 2022 bootstrapper from the Visual Studio downloads page.

EditionDownload
Visual Studio 2022 Enterprisevs_enterprise.exe
Visual Studio 2022 Professionalvs_professional.exe

Tip

If you previously downloaded a bootstrapper file and want to verify what version it is, here's how. In Windows, open File Explorer, right-click the bootstrapper file, choose Properties, choose the Details tab, and then view the Product version number. To match that number to a release of Visual Studio, refer to the Visual Studio build numbers and release dates page.

Tip

If you previously downloaded a bootstrapper file and want to verify its version, here's how. In Windows, open File Explorer, right-click the bootstrapper file, choose Properties, choose the Details tab, and then view the Product version number. To match that number to a release of Visual Studio, refer to the Visual Studio 2019 Releases page.

Tip

Visual Studio Command Prompt (devCmd)

If you previously downloaded a bootstrapper file and want to verify its version, here's how. In Windows, open File Explorer, right-click the bootstrapper file, choose Properties, choose the Details tab, and then view the Product version number. To match that number to a release of Visual Studio, refer to the Visual Studio 2022 Releases page.

You can get the administrator update by going to the Microsoft Update Catalog, search for the update you want to install, and press the Download button. Administrator updates presumes that Visual Studio is already installed on the computer. Applying administrator updates will not initiate a brand new installation.

Bootstrapper commands and command-line parameters

When invoking the Visual Studio bootstrapper programmatically to install the product or to maintain a layout, the first parameter is the command (the verb) that describes the operation to perform. The subsequent optional command line parameters, which are all prefixed by two dashes (--), further define how that operation is supposed to happen. All Visual Studio command-line parameters are case-insensitive, and additional examples can be found on the Command-line parameter examples page.

Starting Visual Studio From A Command Prompt - Stack Overflow

Syntax example: vs_enterprise.exe [command] <optional parameters>...

Visual Studio Code - 3 - Command Line

CommandDescription
(blank)The default command both installs the product, and it is used for all layout maintenance operations.
modifyModifies an installed product.
updateUpdates an installed product.
repairRepairs an installed product.
uninstallUninstalls an installed product.
exportExports installation selection to an installation configuration file. Note: Can only be used with vs_installer.exe.

Important

When specifying multiple distinct workloads or components or languages, you must repeat the --add or --remove command-line switch for each item.

Studio
ParametersDescription
--installPath <dir>For the default install command, this parameter is Optional and describes where the instance will be installed on the client machine. For other commands like update or modify, this parameter is Required and denotes the installation directory for the instance to act upon.
--add <one or more workload or component IDs>Optional: During an install or modify command, this repeatable parameter specifies one or more workload or component IDs to add. The required components of the artifact are installed, but not the recommended or optional components. You can control additional components globally using --includeRecommended and/or --includeOptional parameters. To include multiple workloads or components, repeat the --add command (for example, --add Workload1 --add Workload2). For finer-grained control, you can append ;includeRecommended or ;includeOptional to the ID (for example, --add Workload1;includeRecommended or --add Workload2;includeRecommended;includeOptional). For more information, see the Workload and component IDs page.
--remove <one or more workload or component IDs>Optional: During a modify command, this repeatable parameter specifies one or more workload or component IDs to remove. It complements and behaves similarly to the --add parameter.
--addProductLang <language-locale>Optional: During an install or modify command, this repeatable parameter specifies the UI language packs that should be installed with the product. If not present, the installation uses the language pack that corresponds to the machine locale. For more information, see the List of language locales section on this page.
--removeProductLang <language-locale>Optional: During an install or modify command, this repeatable parameter determines the UI language packs that should be removed from the product. It complements and behaves similarly to the --addProductLang parameter.
--in <path>Optional: The URI or path to a response file which can contain configuration settings.
--allOptional: During an install or modify command, this parameter causes all workloads and components for the product to be installed.
--allWorkloadsOptional: During an install or modify command, this parameter installs all workloads and components, but no recommended or optional components.
--includeRecommendedOptional: During an install or modify command, this parameter includes the recommended components for any workloads that are installed, but not the optional components. The workloads are specified either with --allWorkloads or --add.
--includeOptionalOptional: During an install or modify command, this parameter includes the optional components for any workloads that are installed, but not the recommended components. The workloads are specified either with --allWorkloads or --add.
--quiet, -qOptional: Used with any command, this parameter prevents any user interface from being displayed while the command is being executed.
--passive, -pOptional: This parameter causes the user interface to be displayed in a non-interactive manner. This parameter is mutually exclusive from (and in fact overrides) the --quiet parameter.
--norestartOptional: This parameter must be paired with either the --passive or --quiet parameters. During an install, update, or modify command, adding the --norestart parameter will delay any necessary reboot.
--forceOptional: This parameter forces Visual Studio to close even if any Visual Studio process is in use.
--installWhileDownloadingOptional: During an install, update, or modify command, this parameter allows Visual Studio to both download and install the product in parallel. It's the default experience.
--downloadThenInstallOptional: During an install, update, or modify command, this parameter forces Visual Studio to download all files before installing them. It is mutually exclusive from the --installWhileDownloading parameter.
--nickname <name>Optional: During an install command, this parameter defines the nickname to assign to an installed product. The nickname can't be longer than 10 characters.
--productKeyOptional: During an install command, this parameter defines the product key to use for an installed product. It's composed of 25 alphanumeric characters either in the format xxxxx-xxxxx-xxxxx-xxxxx-xxxxx or xxxxxxxxxxxxxxxxxxxxxxxxx.
--help, --?, -h, -?Displays an offline version of this page.
--config <path>Optional: During an install or modify operation, this determines the workloads and components to add based on a previously saved installation configuration file. This operation is additive and it won't remove any workload or component if they aren't present in the file. Also, items that don't apply to the product won't be added. During an export operation, this determines the location to save the installation configuration file.

Layout command and command-line parameters

All layout management operations assume that the command is the default Install which is (blank). So, all layout management operations should start with the initial required --layout parameter. The table below describes the other parameters you can use to create or update a layout using the command line.

Layout parametersDescription
--layout <dir>Specifies a directory to create or update an offline install cache. For more information, see Create a network-based installation of Visual Studio.
--lang <one or more language-locales>Optional: Used with --layout to prepare an offline install cache with resource packages with the specified language(s). For more information, see the List of language locales section on this page.
--add <one or more workload or component IDs>Optional: One or more workload or component IDs to add. The required components of the artifact are installed, but not the recommended or optional components. You can control additional components globally using --includeRecommended and/or --includeOptional. For finer-grained control, you can append ;includeRecommended or ;includeOptional to the ID (for example, --add Workload1;includeRecommended or --add Workload2;includeOptional). For more information, see the Workload and component IDs page.
Note: If --add is used, only the specified workloads and components and their dependencies are downloaded. If --add isn't specified, all workloads and components are downloaded to the layout.
--includeRecommendedOptional: Includes the recommended components for any workloads that are installed, but not the optional components. The workloads are specified either with --allWorkloads or --add.
--includeOptionalOptional: Includes the recommended and optional components for any workloads being included in the layout. The workloads are specified with --add.
--keepLayoutVersionOptional: Apply changes to the layout without updating the version of the layout.
--verifyOptional: Verify the contents of a layout. Any corrupt or missing files are listed.
--fixOptional: Verify the contents of a layout. If any files are corrupt or missing, they're redownloaded. Internet access is required to fix a layout.
--clean <one or more paths to catalogs>Optional: Removes old versions of components from a layout that has been updated to a newer version.
Advanced layout parametersDescription
--channelId <id>Optional: The ID of the channel for the instance to be installed. This is required for the install command, and ignored for other commands if --installPath is specified.
--channelUri <uri>Optional: The URI of the channel manifest. If updates aren't wanted, --channelUri can point to a non-existent file (for example, --channelUri C:doesntExist.chman). This can be used for the install command; it's ignored for other commands.
--installChannelUri <uri>Optional: The URI of the channel manifest to use for the installation. The URI specified by --channelUri (which must be specified when --installChannelUri is specified) is used to detect updates. This can be used for the install command; it's ignored for other commands.
--installCatalogUri <uri>Optional: The URI of the catalog manifest to use for the installation. If specified, the channel manager attempts to download the catalog manifest from this URI before using the URI in the install channel manifest. This parameter is used to support offline install, where the layout cache will be created with the product catalog already downloaded. This can be used for the install command; it's ignored for other commands.
--productId <id>Optional: The ID of the product for the instance that will be installed. This is pre-populated in normal installation conditions.
--waitOptional: The process will wait until the install is completed before returning an exit code. This is useful when automating installations where one needs to wait for the install to finish to handle the return code from that install.
--locale <language-locale>Optional: Change the display language of the user interface for the installer itself. Setting will be persisted. For more information, see the List of language locales section on this page.
--cacheOptional: If present, packages will be kept after being installed for subsequent repairs. This overrides the global policy setting to be used for subsequent installs, repairs, or modifications. The default policy is to cache packages. This is ignored for the uninstall command. Read how to disable or move the package cache for more information.
--nocacheOptional: If present, packages will be deleted after being installed or repaired. They'll be downloaded again only if needed and deleted again after use. This overrides the global policy setting to be used for subsequent installs, repairs, or modifications. The default policy is to cache packages. This is ignored for the uninstall command. Read how to disable or move the package cache for more information.
--noUpdateInstallerOptional: If present, prevents the installer from updating itself when quiet is specified. The installer will fail the command and return a non-zero exit code if noUpdateInstaller is specified with quiet when an installer update is required.
--noWebOptional: If present, Visual Studio setup uses the files in your layout directory to install Visual Studio. If a user tries to install components that aren't in the layout, setup fails. For more information, see Deploying from a network installation.
Important: This switch doesn't stop Visual Studio setup from checking for updates. For more information, see Control updates to network-based Visual Studio deployments.
--path <name>=<path>Optional: Used to specify custom install paths for the installation. Supported path names are shared, cache, and install.
--path cache=<path>Optional: Uses the location you specify to download installation files. This location can only be set the first time that Visual Studio is installed. Example: --path cache='C:VScache'
--path shared=<path>Optional: Contains shared files for side-by-side Visual Studio installations. Some tools and SDKs install to a location on this drive, while some others might override this setting and install to another drive. Example: --path shared='C:VSshared'
Important: This can be set only once and on the first time that Visual Studio is installed.
--path install=<path>Optional: Equivalent to –-installPath. Specifically, --installPath 'C:VS' and --path install='C:VS' are equivalent. Only one of these commands can be used at a time.

Administrator update command and command-line parameters

If you download an administrator update from the Microsoft Update Catalog into your installation directory on your client machine, you can just double click on the file to apply the update. You can also open a command window and pass some of the parameters below to change the default behavior.

See Full List On Docs.microsoft.com

If you are deploying the administrator update through Microsoft Endpoint Manager (SCCM), you can modify the package to adjust the behavior by using the parameters below. You can also control the parameters via a configuration file on the client machine. For more information, refer to Methods for configuring an administrator update

Note that all administrator update parameters are run in the 'update' context.

Administrator update parametersDescription
--installerUpdateArgs [optional parameters]This parameter functions as a 'pass-through array' of specific parameters that are relevant to administrator update scenarios. Optional parameters that are enabled for this purpose are:
--quiet: This is the default experience for administrator updates and is listed here for completeness.
--passive: This parameter overrides the --quiet parameter. It causes the UI to appear in a non-interactive manner.
--norestart: This parameter must be used in conjunction with either --quiet or --passive and it causes any necessary reboots to be delayed.
--noWeb: This parameter prevents Visual Studio from checking on the internet for updates to the product.
--force: This parameter forces Visual Studio to close, even if Visual Studio is in use. Use this parameter with caution, as it may cause loss of work. This parameter must be used in user context.
--installWhileDownloading: This parameter allows Visual Studio to both download and install the product in parallel. It's the default experience for administrator updates and is listed here for completeness.
--downloadThenInstall: This parameter forces Visual Studio to download all files before installing them. It is mutually exclusive from the --installWhileDownloading parameter.
--checkPendingRebootThe update will be aborted if there is a pending reboot on the machine, regardless of which application may have caused it. The default is to not check for pending reboots.

Syntax example: visualstudioupdate-16.9.0to16.9.4.exe --installerUpdateArgs=--force,--noWeb --checkPendingReboot

List of workload IDs and component IDs

For a list of workload and component IDs sorted by Visual Studio product, see the Visual Studio workload and component IDs page.

List of language locales

Language-localeLanguage
Cs-czCzech
De-deGerman
En-usEnglish
Es-esSpanish
Fr-frFrench
It-itItalian
Ja-jpJapanese
Ko-krKorean
Pl-plPolish
Pt-brPortuguese - Brazil
Ru-ruRussian
Tr-trTurkish
Zh-cnChinese - Simplified
Zh-twChinese - Traditional

Error codes

Depending on the result of the operation, the %ERRORLEVEL% environment variable is set to one of the following values:

ValueResult
0Operation completed successfully
740Elevation required
1001Visual Studio installer process is running
1003Visual Studio is in use
1602Operation was canceled
1618Another installation running
1641Operation completed successfully, and reboot was initiated
3010Operation completed successfully, but install requires reboot before it can be used
5003Bootstrapper failed to download installer
5004Operation was canceled
5005Bootstrapper command-line parse error
5007Operation was blocked - the computer does not meet the requirements
8001Arm machine check failure
8002Background download precheck failure
8003Out of support selectable failure
8004Target directory failure
8005Verifying source payloads failure
8006Visual Studio processes running
-1073720687Connectivity failure
-1073741510Microsoft Visual Studio Installer was terminated (by the user or external process)
Other
(for example:
-1, 1, 1603)
Failure condition occurred - check the logs for more information

Each operation generates several log files in the %TEMP% directory that indicate the progress of the installation. Sort the folder by date and look for files that begin with dd_bootstrapper, dd_client, and dd_setup for the bootstrapper, the installer app, and the setup engine, respectively.

Get support

Sometimes, things can go wrong. If your Visual Studio installation fails, see Troubleshoot Visual Studio installation and upgrade issues for step-by-step guidance.

We also offer an installation chat (English only) support option for installation-related issues.

Here are a few more support options:

  • Report product issues to us via the Report a Problem tool that appears both in the Visual Studio Installer and in the Visual Studio IDE.
  • Suggest a feature, track product issues, and find answers in the Visual Studio Developer Community.
  • Use your GitHub account to talk to us and other Visual Studio developers in the Visual Studio conversation in the Gitter community.

Visual Studio Command Line Debugger

See also