It turns out that MSBuild.exe looks for an environment variable if you don’t explicitly define a platform in the arguments. And indeed, my System Environment Variables contain a ‘Platform’ variable with the value ‘HPD’. What’s HPD you might ask? My machine is a HP Pavilion Elite, a desktop machine. So I guess that makes the HPD acronym. The solution however is very simple, you either remove the environment variable or you define the platform when calling msbuild.exe like this:
%WINDIR%Microsoft.NETFrameworkv4.0.30319msbuild.exe BuildBuild.proj /p:Configuration="%config%" /p:Platform="Any CPU"