How do I target .NET 4.0.3 on XP using Visual Studio 2012? Application fails to run with "not a valid Win32 application"

We are also having this problem. It isn't a matter of what framework your application is targeting (we are targetting the 4.0 client).

The problem is that Visual Studio 2012 will not produce a click once setup.exe that will run on XP. The error is missleading as it always reports that the program is not a valid Win32 application. It does this on any version of XP including 64-bit versions.

It is not your application causing the problem, it is the setup.exe produced by VS2012. The only way we have found to get around it is to publish using VS2010.


I'm not certain this will work, but try the trick shown here to manually set the subsystem version with EditBin.exe.


Microsoft just recently posted a fix for this. (Express versions included.)

Details at: http://blogs.msdn.com/b/smondal/archive/2012/10/15/setup-exe-is-not-a-valid-win32-application.aspx