Targeting .NET 4.0 gives invalid Win XP application since TFS .NET 4.5 upgrade
We have a TFS build server (I think it's called a build controller in TFS terminology). It builds and deploys several solutions. One of these solutions, a Windows Forms project targeting .NET 4 full profile and x86, used to work fine on Windows XP, and now fails to run with the message:
*.exe is not a valid win32 application on Windows XP
We have a build from 3 months ago that works fine and nothing relevant has changed in the source code since. But when requesting a new build from the build server now, the resulting .exe (with a lot of .dlls to support it) cannot be run on Windows XP 32-bit. The same build runs fine on Windows 7 32-bit and Windows 7 64-bit.
My best guess it that something installed on the build server in the last three months is making the difference. A lot of stuff has been installed, including .NET 4.5, Visual Studio 2012 etc. Still, it shouldn't change a solution targeting 4.0.
.net 4.5 upgrades .net 4.0 so if you have .net 4.5 installed on your build server, and you're targetting .net 4.0, this isn't the same .net 4.0 that you have installed on XP. You cannot install .net 4.5 on XP. This Blog goes in to more detail.
Basically if you want to support XP, you cannot use .net 4.5 / Visual Studio 2012. (or have them installed on your build machines)