MSBuild installation
BuildTools_Full.exe
Windows development
MSBuild.exe location
software installation paths

Where is MSBuild.exe installed in Windows when installed using BuildTools_Full.exe?

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

When installed via BuildTools_Full.exe, MSBuild.exe is located under the Visual Studio Build Tools installation directory, typically at C:\Program Files (x86)\Microsoft Visual Studio\<year>\BuildTools\MSBuild\Current\Bin\MSBuild.exe. The exact path varies depending on the Visual Studio year (2017, 2019, 2022) and whether you installed Build Tools or a full Visual Studio edition. The most reliable way to find MSBuild on any machine is to use vswhere.exe rather than hard-coding a path.

Default Installation Paths by Version

The path follows a consistent pattern across Visual Studio versions. The differences are the year segment and, in 2017, a versioned subfolder instead of the Current alias.

Visual Studio VersionTypical MSBuild.exe Path
2022 Build ToolsC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe
2019 Build ToolsC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe
2017 Build ToolsC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
2022 Community/Professional/EnterpriseC:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe
Standalone .NET SDK (dotnet CLI)C:\Program Files\dotnet\sdk\<version>\MSBuild.dll (invoked via dotnet msbuild)

Note that Visual Studio 2022 installs to Program Files (not Program Files (x86)) when using a full edition, because 2022 is a 64-bit application. Build Tools installers may still use the x86 path depending on the installer version.

64-bit vs 32-bit MSBuild

Starting with VS 2022, Microsoft ships both 32-bit and 64-bit versions of MSBuild.

 
MSBuild\Current\Bin\MSBuild.exe          # 32-bit
MSBuild\Current\Bin\amd64\MSBuild.exe    # 64-bit

For most projects, either works. The 64-bit version is useful when building large solutions that hit the 32-bit process memory limit (around 2 GB). Some older tasks and targets only work with the 32-bit version.

Using vswhere.exe for Reliable Discovery

Hard-coding a path breaks when the machine has a different Visual Studio year, edition, or custom install location. Microsoft ships vswhere.exe with the Visual Studio Installer, and it is the recommended way to locate MSBuild.

Find MSBuild from Any Installed Visual Studio Product

powershell
1$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
2
3& $vswhere -products * `
4  -requires Microsoft.Component.MSBuild `
5  -find "MSBuild\**\Bin\MSBuild.exe"

This searches all installed products (Community, Professional, Enterprise, and Build Tools) and returns every MSBuild.exe it finds.

Find Only the Latest Installation

powershell
1$msbuild = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" `
2  -latest `
3  -products * `
4  -requires Microsoft.Component.MSBuild `
5  -find "MSBuild\**\Bin\MSBuild.exe" |
6  Select-Object -First 1
7
8Write-Host "MSBuild found at: $msbuild"
9& $msbuild MySolution.sln /t:Build /p:Configuration=Release

Get the Installation Path (Not MSBuild Directly)

Sometimes you need the installation root rather than the MSBuild binary.

powershell
1$installPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" `
2  -latest `
3  -products * `
4  -property installationPath
5
6$msbuild = Join-Path $installPath "MSBuild\Current\Bin\MSBuild.exe"

CMD Batch File Version

batch
1@echo off
2for /f "usebackq tokens=*" %%i in (
3  `"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe`
4) do set MSBUILD=%%i
5
6echo MSBuild found at: %MSBUILD%
7"%MSBUILD%" MySolution.sln /t:Build /p:Configuration=Release

Using the Developer Command Prompt

For interactive use, the Developer Command Prompt or Developer PowerShell for Visual Studio pre-configures PATH so that MSBuild.exe can be called without a full path.

batch
MSBuild.exe MySolution.sln /t:Rebuild /p:Configuration=Debug

You can find these shortcuts in the Start Menu under "Visual Studio 2022" (or the relevant year). They invoke VsDevCmd.bat, which sets up environment variables including the path to MSBuild.

This is convenient for manual builds, but CI pipelines and automation scripts should not depend on it because the environment setup is not always available in headless runners.

Build Tools vs Full Visual Studio

The folder segment after the year changes depending on what you installed.

InstallationFolder Segment
Build Tools onlyBuildTools
Community editionCommunity
Professional editionProfessional
Enterprise editionEnterprise

A machine can have multiple installations (e.g., Build Tools 2019 and Enterprise 2022). vswhere lists all of them. Scripts that assume only one installation or only BuildTools fail on developer machines with full Visual Studio installed.

If vswhere.exe is not available (rare, but possible on machines with very old or custom setups), you can search the filesystem directly.

powershell
1Get-ChildItem "C:\Program Files (x86)\Microsoft Visual Studio" -Recurse -Filter MSBuild.exe -ErrorAction SilentlyContinue |
2    Select-Object FullName
3
4Get-ChildItem "C:\Program Files\Microsoft Visual Studio" -Recurse -Filter MSBuild.exe -ErrorAction SilentlyContinue |
5    Select-Object FullName

This is slow on large directory trees and returns every copy without telling you which one is the correct version for your project. Use it only for diagnosis.

Verifying the MSBuild Version

Once you find MSBuild, confirm you have the right version.

powershell
& "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe" -version

Output:

 
Microsoft (R) Build Engine version 17.8.3+195e7f5a3 for .NET Framework

The major version number maps to the Visual Studio version: 17.x is VS 2022, 16.x is VS 2019, 15.x is VS 2017.

Common Pitfalls

  • Hard-coding a specific year in CI scripts. When the build agent upgrades to a newer Visual Studio version, the path breaks. Use vswhere to dynamically resolve the path.
  • Assuming MSBuild.exe is on PATH. It is only on PATH in Developer Command Prompt sessions, not in regular cmd.exe or PowerShell windows.
  • Searching only Program Files (x86). Visual Studio 2022 full editions install to Program Files (without x86). Searching only the x86 directory misses them.
  • Ignoring the 64-bit vs 32-bit distinction. Some build tasks fail with the 64-bit MSBuild if they depend on 32-bit COM components. If you see build errors about missing components, try the 32-bit version explicitly.
  • Using a version-specific folder like 15.0 in scripts. This only works for VS 2017. VS 2019 and later use Current as the folder name. The Current alias is forward-compatible and should be preferred.
  • Forgetting that the .NET SDK bundles its own MSBuild. Projects using the SDK-style .csproj format can be built with dotnet build instead of invoking MSBuild.exe directly. For SDK-style projects, dotnet build is often simpler.

Summary

  • MSBuild.exe from BuildTools_Full.exe is installed under C:\Program Files (x86)\Microsoft Visual Studio\<year>\BuildTools\MSBuild\Current\Bin\.
  • The exact path depends on the Visual Studio year and whether Build Tools or a full edition is installed.
  • Use vswhere.exe to discover the path programmatically. It handles version differences, multiple installations, and custom install locations.
  • Developer Command Prompt adds MSBuild to PATH for interactive use, but automation should resolve the path explicitly.
  • For .NET SDK-style projects, dotnet build is an alternative that does not require locating MSBuild.exe at all.

Course illustration
Course illustration

All Rights Reserved.