Reputation: 185
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?
Upvotes: 10
Views: 4085
Reputation: 76670
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.
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.
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.
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.
Upvotes: 14