Solving MSBuild failure on platform HPD

DataAnnotationExtension from github and try to run the build.cmd that comes with it. What do I get… a lot of red: Build FAILED. Never good.

MSBuild - build failure - target platform HPDMSBuild – build failure – target platform HPD

The specified solution configuration "release|HPD" is invalid.

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"

Source: MSBuild and its use of the “Platform” environment variable system environment variable hpd