Search code examples
visual-studioinstallationvisual-studio-2022winget

How to install 64 bit Visual Studio 2022 buildtools on my pc using winget


I am trying to install visual studio buildtools using winget through the following command

winget install -e --id Microsoft.VisualStudio.2022.BuildTools --override "--passive --wait --add Microsoft.VisualStudio.Workload.VCTools;includeRecommended"

But it always installs in the C:\Program Files (x86)\Microsoft Visual Studio directory.

I am trying to install the 64 bit version and I am not sure what arguments I have to pass.


Solution

  • Visual Studio 2022 itself is a 64-bit application. "C:\Program Files (x86)\Microsoft Visual Studio" is the default installation location for Microsoft.VisualStudio.2022.BuildTools.If you want to change the location of this installation, you can use --installPath to customize the installation.

    winget install -e --id Microsoft.VisualStudio.2022.BuildTools --override "--passive --wait --add Microsoft.VisualStudio.Workload.VCTools --installPath your location"
    

    Docs Referred:

    https://learn.microsoft.com/en-us/visualstudio/install/use-command-line-parameters-to-install-visual-studio?view=vs-2022#use-winget-to-install-or-modify-visual-studio