7
votes

I have the VS 2012 on windows 7. I want to build a MFC program which can be run on windows XP. However I received the following error while I moved the exe file to windows XP: “It is not a valid win32 application”.

After exploring on internet, I discovered that I should install Visual Studio 2012 Update 1 and change the Platform toolset from “Visual Studio 2012 (v110)” to “Visual Studio 2012 - Windows XP (v110_xp)”. I also changed the target machine to “MachineX86 (/MACHINE:X86)”. This time I receive another error while I run the exe file on windows XP: “the procedure entry point initializecriticalsection could not be located in the dynamic library KERNEL32.dll”.

Now I do not know what to do :(. I do appreciate if some can help me :).

Please note that I tried a simple dialog MFC program without adding any code to it.

1
When you tried the simple MFC project did it work or fail? - Captain Obvlious
I didn't even know you cold target XP with 2012. I guess the update granted that by popular demand. You mentioned "Please note that I tried a simple dialog MFC program without adding any code to it." and then... nothing. What was the result, or are we to assume it was the same? - WhozCraig
If in the future please do not link to binary downloads. If you must provide a link it should be to the description, source code or download page. - Captain Obvlious
Make sure you have XP SP3. And simply setting the toolset to v110_xp should be enough. I've built a much more complex application with VS2012 that had to target XP just by flipping that switch. Worked like a charm. A few people on the VC++ blog did have some problems though, read the comments: blogs.msdn.com/b/vcblog/archive/2012/10/08/10357555.aspx Pay attention to the last one by Daniel about /SUBSYSTEM:WINDOWS,5.01. Also make sure you have the right redistributable installed on the client machine. (Update 1 vs Update 2 makes a difference, it has to be the same version as VS2012.) - ta.speot.is
ta.speot.is: I have the windows xp service pack 3 version 2002. but still have the same problem. I have updated my Visual studio 2012 to the last version as well but still dose not work. - shervin

1 Answers

2
votes

This is a bug in Visual Studio 2012 Update 2. The link has a workaround for Update 2 (although a community sourced one), and Microsoft has this to say:

Posted by Microsoft on 06/05/2013 at 16:16

Yes, this is fixed in Update 3

So your best bet is to roll back to Update 1 or wait for Update 3.

EDIT Visual Studio 2012 Update 3 Release Candidate has been released with "go-live" licensing. Caveat:

Statement of Support:

Visual Studio 2012 Update 3 RC and Team Foundation Server 2012 with Update 3 RC are “go-live”. This means that customers can use these builds in production environments. These are still pre-releases, so there may be some bugs that will be fixed for the final release. Upgrade from Update 3 RC to Update 3 RTM is supported. In order to upgrade to future releases, the customer must first upgrade from Update 3 RC to Update 3 RTM.

More information is available here.

EDIT 2 Turns out rolling back to Update 1 breaks Visual Studio...