72

I'm trying to set up a build server for .NET, but can't figure out where MSBuild.exe is installed.

I'm trying to install MSBuild using the Microsoft Build Tools 2013: https://www.microsoft.com/en-us/download/details.aspx?id=40760

jonasm
  • 977
  • 1
  • 8
  • 14
  • 2
    did you try "where msbuild" at the command line? note I'm assuming - quite possibly incorrectly - that it is added to the path – Marc Gravell Jun 15 '17 at 12:17
  • when I'm searching the C drive for MSBuild.exe, I only get paths to MSBuild.exe in C:\Windows. According to this on MSDN, MSBuild should be in Program Files: https://msdn.microsoft.com/en-us/library/hh162058.aspx – jonasm Jun 15 '17 at 12:23

8 Answers8

65

As per https://learn.microsoft.com/en-us/visualstudio/msbuild/what-s-new-in-msbuild-15-0

MSBuild is now installed in a folder under each version of Visual Studio. For example, C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild. You can also use the following PowerShell module to locate MSBuild: vssetup.powershell.

MSBuild is no longer installed in the Global Assembly Cache. To reference MSBuild programmatically, use NuGet packages.

Community
  • 1
  • 1
Aniket Thakur
  • 66,731
  • 38
  • 279
  • 289
  • 1
    this path may also be `C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin` if you are using the Community version – wal May 01 '19 at 05:24
  • 18
    When installed from "Build Tools" package the path is `C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin` – tommyk Jul 01 '19 at 11:49
  • 1
    For 2022 Enterprise, I found it here: `C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin` – krillgar Jun 14 '22 at 16:30
52

MSBuild in the previous versions of .NET Framework was installed with it but, they decided to install it with Visual Studio or with the package BuildTools_Full.exe.

The path to MSBuild when installed with the .NET framework:

C:\Windows\Microsoft.NET\Framework[64 or empty][framework_version]

The path to MSBuild when installed with Visual Studio is:

C:\Program Files (x86)\MSBuild[version]\Bin for x86

and

C:\Program Files (x86)\MSBuild[version]\Bin\amd64 for x64.

The path when BuildTools_Full.exe is installed is the same as when MSBuild is installed with Visual Studio.

Mike G
  • 4,232
  • 9
  • 40
  • 66
GenTech
  • 668
  • 6
  • 9
  • The program "Everything" helped me to find it just search "msbuild.exe" it will list each and every file with that name on your PC together with the path. – Peheje Dec 18 '19 at 11:47
  • Also, you can use "where msbuild" in Developer command prompt – GenTech Sep 13 '20 at 20:37
39

Open the Microsoft command line. I'm using Visual Studio 2019, so my command line is "Developer Command Prompt for VS 2019".

Then run the command (the Where-Object Powershell command)

where msbuild

And the path will be echo'd.

Or try this (the where.exe program/executable)

where.exe /R C:\ msbuild

More here on the difference between:

  • where Powershell alias /Where-Object Powershell command vs
  • where.exe executable
Nate Anderson
  • 18,334
  • 18
  • 100
  • 135
Ev.
  • 7,109
  • 14
  • 53
  • 87
19

You can find the VS2019 here : C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe

Karvan
  • 250
  • 2
  • 7
8

This worked for me (this searches msbuild.exe in c:\ - the default didn't work)

where /R c:\ msbuild.exe
thewpfguy
  • 794
  • 6
  • 15
4

For MsBuild 17:

C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin

For MsBuild 16:

C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin

For MsBuild 15:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild (or replace 'Enterprise' with 'Professional' or 'Community')

Sergioet
  • 1,108
  • 13
  • 27
Rocklan
  • 7,888
  • 3
  • 34
  • 49
  • 4
    Visual Studio 2022 (MSBuild 17) is 64 bit, therefore the location of which is in Program Files not "Program Files (x86)" – Jawad Sabir Feb 26 '22 at 05:19
  • as per Jawad, found VS 2022 at C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin – Sergioet Feb 17 '23 at 12:01
0

Here is a big dump of possible places, to save a few minutes' searching

Dotnet SDK from stand-alone installer:

C:\Program Files\dotnet\sdk\5.0.406\MSBuild.exe
C:\Program Files\dotnet\sdk\5.0.406\amd64\MSBuild.exe
C:\Program Files\dotnet\sdk\7.0.203\MSBuild.dll

From Visual Studio installer:

C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\Tools\vsdevcmd\core\msbuild.bat
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\amd64\MSBuild.exe
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\vsdevcmd\core\msbuild.bat
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\amd64\MSBuild.exe

JetBrains Rider self-installs:

C:\Users\...\AppData\Local\JetBrains\BuildTools\MSBuild\Current\Bin\MSBuild.exe
   C:\Users\...\AppData\Local\JetBrains\BuildTools\MSBuild\Current\Bin\amd64\MSBuild.exe

Old "Framework"

C:\Windows\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe
C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\MSBuild.exe
C:\Windows\Microsoft.NET\Framework64\v3.5\MSBuild.exe
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe
Iain Ballard
  • 4,433
  • 34
  • 39
0

I find it here

C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin

or

C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64

for 64bit version.

R15
  • 13,982
  • 14
  • 97
  • 173