7

I was looking for MSBuild.exe, and I found it in two slightly different places:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\amd64\MSBuild.exe

What's the difference between them and which should I use?

Valerii Gruu
  • 155
  • 1
  • 2
  • 6
  • 1
    Microsoft generally makes build tools available both in their 32-bit and their 64-bit version. Where the 64-bit version can be expected to handle much larger build jobs. Sometimes that is useful, the C++ compiler for example. Sometimes it makes no sense because the tool could not possibly ever run out of memory. Like MSBuild. A corner-case is the build tool itself having to load a 64-bit custom build DLL. Technically possible for MSBuild. Only technically. – Hans Passant Sep 15 '17 at 07:41

1 Answers1

12

What's the difference between them?

The MSBuild.exe has two versions, 32-bit and 64-bit.

On 32-bit machines, the MSBuild.exe exists in the path: C:\Program Files\..\..\Bin\MSBuild.exe

On 64-bit machines, there are two version of MSBuild.exe tool. The 32-bit tools will be under: Bin\MSBuild.exe and the 64-bit tools under: Bin\amd64\MSBuild.exe

If you want to know some differences between these two versions, you can refer to the blog: Building on Cross targeting scenarios and 64-bit MSBuild.

which should I use?

To answer this question, you should to know the differences between 32-bit program and 64-bit program. You can refer this document for detail.

  1. If the assembly is configured for Any CPU then it will run as x64 on a 64-bit machine and as x86 on a 32-bit machine.

  2. If the assembly is configured for x86 then it will run as WOW64 on a 64-bit machine (i.e. a 32-bit process) and as x86 on a 32-bit machine.

  3. If the assembly is configured for x64 then it will run as x64 on a 64-bit machine and will fail to run on a 32-bit machine

So you should use Bin/MSBuild.exe, which can be run on 64-bit machine and as x86 on a 32-bit.

Besides, Visual Studio build is equivalent to running 32-bit MSBuild.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135