Can't run Visual Studio 2012 program on Windows XP

.net, runtime-error, visual-studio, windows-7-x64, windows-xp

Solution

The steps I used (without creating a new project):

- Open the project settings, choose Application.

- On "Target framework", choose .Net Framework 4.

- Recompile

That's it.

Remember to also set the Publish (one-click) setting under "Prerequisites" to use Framework 4, if you're using the publish feature. I found the client version of the framework doesn't seem to cut it, you need the full version despite what the documentation seems to indicate, but maybe that's on a project-by-project basis.

Problem

I have a simple C# console application built using Visual Studio 2012 and .NET 4.5. When I build the solution on my 64 bit Windows 7 machine and then copy the MyProgram.exe file from this location: C:\Users\me\Desktop\MyProgram\MyProgram\bin\x86 to a Windows XP machine, and then try to run the MyProgram.exe file, I get the following error: ``` MyProgram.exe is not a valid win32 application ``` I can see by just Googling the problem that lots of other people have the same issue and there are many suggested solutions. But none of the solutions seem to help me. Can someone please give me step-by-step instructions for how to prepare the .exe file to run on XP?

Original source

Related problems