While working on a recent customer case, we observed the following error message, MSBuild.exe is not a valid Win32 application.
A project is build using the MSBuild.exe and the following error message is shown.
Windows 7/Server 2008 R2/ Windows XP/ Server 2003 R2/ Server 2003 (with .NET Framework 4.0 Full installed)
Symptom and inference:
We started the troubleshooting by checking the size, digital signature and other attributes of the file “C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe”. In our case size of the file was 0 KB. Verified the same file in the other folder “C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe” and found the size was 129 KB (132,432 bytes). Which clearly indicates that the file ‘MSBuild.exe’ was corrupted.
In order to fix this issue, the file was renamed to “MSBuild.exe.old” and then we started the repair of .NET Framework 4.0 Client Profile from ‘Programs and Features’. This process was able to replace the corrupted MSBuild.exe file with a new one.
A computer reboot may be necessary, if prompted by the setup, the computer must be restarted.
The build process worked as expected after the repair and reboot.
Content by: Keshav Jain.