XE2 (or more exactly, MSBuild) vs. HP notebooks and desktops

For all I know it may have been an issue with earlier versions, but I’ve just installed XE2 Pro on my HP notebook (it already had XE Starter and a few VS Expresses) and stumbled across a small issue. When attempting to compile, the following error message came up:

[Error Error] Invalid PLATFORM variable “MCD”. PLATFORM must be one of the following: “Win32”, “Win64”, or “OSX32”. If PLATFORM is defined by your system’s environment, it must be overridden in the RAD Studio IDE or passed explicitly on the command line to MSBuild; e.g., /p:Platform=Win32.

Didn’t matter what I did in the IDE itself, the error wouldn’t go away. Turns out HP in their wisdom set up many of their notebooks and desktops to have a system environment variable called Platform with values such as MCD, and MSBuild thinks this is the platform you’re trying to compile for. The fix was simple though – I just had to delete the variable. From the Start menu, start typing environment variable, then select Edit the system environment variables. Click the Environment Variables button at the bottom of the resulting dialog, find Platform under System variables, and press Delete. OK the dialog, restart the Delphi IDE, and everything should be fine.

14 thoughts on “XE2 (or more exactly, MSBuild) vs. HP notebooks and desktops

  1. BAD choice from Embarcadero, MS & HP – they shouldn’t have called it Platform, but use more specific term, being most env variables global across a system (but per user ones), and anyway global for a given user logon.

  2. Such environment variables should start with a unique, vendorbased string, like EMBC_, in this case EMBC_Platform 🙂

    Or is it Microsoft who did the mistake ? In case, it should be MS_Platform 🙂 Or MSBuild_Platform ??

    • Well I suppose if you leverage MSBuild, you’re stuck with MSBuild behaviour – apparently the problem affects Visual Studio too. Using a global environment variable for something build configuration-specific seems pretty silly to me, but then I’ve never written a multi-tool build system before, so what do I know!

      That said, MSBuild’s been let off lightly – the finger print reader software that HP bundled with my notebook periodically crashes Office like a dodgem car…

    • Well actually i found another solution except for deleting the variable. You can just open your embarcadero program. Go to tools and then select options. On your left hand select Enviromantal Variables and search for Platform. Select it and click Add Override. On the resulting dialog change the Variable Value to Win32,Win64 or OSX32 and click Ok. Done. Now your program will compile the projects just fine. At least it worked for me.

Leave a comment