Question

I have Visual Studio 2010 in a 32-bit Windows 7. I need to compile my created vb.net program (lets call it myprogram.exe) to be able to run in a 64-bit Windows 7 environment.

I have set my VS2010 project to "Any CPU" and even so myprogram.exe doesn't run on a 64-bit Windows 7. However, it does on a 32-bit Windows 7.

Could be possible it's because I'm using System.Data.OracleClient for database connection?

Error message in 64-bit Windows 7:

"The version of this file is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need an x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher"

The 64-bit Windows 7 has Framework v2 installed. I attach some picture to show that.

Supposedly, WOW64 should run automatically but will not work on all applications.

In this case, should I install on my 64-bit Windows 7 some "Windows virtual PC"?

enter image description here

EDIT:

My VS2010 Premium is in a 32-bit Windows7 environment, and only see "Any CPU" option available. I don't see any other one else.

enter image description here

Should I install in the 64-bit Windows7 PC some "32-bit virtual Windows7 "? Which one would you recommend?

Was it helpful?

Solution

If you compile your program with the target platform set to AnyCPU then, when you run you executable on a 64bit OS the JIT compiler emits code for 64bit systems and, on 32bit OS, code for 32bit systems.

From your error it is clear that something between your references is a 32bit only library and thus cannot be called from 64bit code.

You could switch back to 32bit setting the x86 target platform in your Build Configuration or try to identify the library responsible and check if a 64bit version exists.

However, if you don't have specific reasons to use AnyCPU then you could still use x86 because in some cases the performances are better than 64bit code

You could read about the PROS and CONS of AnyCPU in this a little old, but still valuable, article

OTHER TIPS

Try instead setting it from "Any CPU" to "x86" to force it to run on the 32-bit architecture. The problem might be that your program is relying on DLLs that aren't supported on the 64-bit architecture.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top