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 Version | Typical MSBuild.exe Path |
| 2022 Build Tools | C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe |
| 2019 Build Tools | C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe |
| 2017 Build Tools | C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe |
| 2022 Community/Professional/Enterprise | C:\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.
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
This searches all installed products (Community, Professional, Enterprise, and Build Tools) and returns every MSBuild.exe it finds.
Find Only the Latest Installation
Get the Installation Path (Not MSBuild Directly)
Sometimes you need the installation root rather than the MSBuild binary.
CMD Batch File Version
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.
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.
| Installation | Folder Segment |
| Build Tools only | BuildTools |
| Community edition | Community |
| Professional edition | Professional |
| Enterprise edition | Enterprise |
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.
Fallback: Manual Search
If vswhere.exe is not available (rare, but possible on machines with very old or custom setups), you can search the filesystem directly.
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.
Output:
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
vswhereto dynamically resolve the path. - Assuming
MSBuild.exeis onPATH. It is only onPATHin Developer Command Prompt sessions, not in regularcmd.exeor PowerShell windows. - Searching only
Program Files (x86). Visual Studio 2022 full editions install toProgram 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.0in scripts. This only works for VS 2017. VS 2019 and later useCurrentas the folder name. TheCurrentalias is forward-compatible and should be preferred. - Forgetting that the .NET SDK bundles its own MSBuild. Projects using the SDK-style
.csprojformat can be built withdotnet buildinstead of invokingMSBuild.exedirectly. For SDK-style projects,dotnet buildis 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.exeto discover the path programmatically. It handles version differences, multiple installations, and custom install locations. - Developer Command Prompt adds MSBuild to
PATHfor interactive use, but automation should resolve the path explicitly. - For .NET SDK-style projects,
dotnet buildis an alternative that does not require locating MSBuild.exe at all.

