Error message “MSBuild.exe is not a valid Win32 application” is shown while trying to build using MSBuild.exe.


While working on a recent customer case, we observed the following error message, MSBuild.exe is not a valid Win32 application.

Issue Description:

A project is build using the MSBuild.exe and the following error message is shown.


OS Environment:

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.

Comments (1)

  1. chris says:

    I am now having this issue on my Windows 7 64-bit dev box. In VS2012 I can build my project just fine. But if I use msbuild, in which I have been using for a year now, it give me the same error message. I followed the procedure listed above but no luck. It has Framework 4.5.2 on it. And I use nuget for my packages, etc. I just recently updated my project to jquery 2.1.1, but that was the only thing I've done to it. Can you offer any assistance?