BadImageException on 64Bit Windows7 using c++\CLI assembly

I recently upgraded to a new 64 bit windows 7 computer from a 32 bit windows xp. I am attempting to create a c++\cli assembly in visual studio 2008 that will be used in an exe. I ran into problems with this and decided to just create an ultra-simple example. However, the simple project also displayed the same error (attached is screen shot of badimageexception error). I moved that example project back to my 32 bit machine and recompiled and ran it and everything worked fine. So it is obviously something to do with a discrepancy between 32 and 64 bit images. I googled this exception and this seemed to confirm this as well. However, I have tried changing every setting I can think of to force the system to build everything as 32 bit and it still blows up. I have gone into the configurations of both the app and lib and set everything to use Win32 and not "Any CPU", and the targeted machine in the c++ lib is MachineX86. I am not sure what else to try on this one to get it to actually compile and work on the new computer. Any help resolving this issue would be greatly appreciated. I tried to attach a zip with the VS projects, but I could not do so because of the completely assinine verification of the extension types. Instead I had to place it on my site. Here is a link to the zip file. (http://www.animatlab.com/CLI_Test.zip). I was able to add an image of the exception I get. I initially created a member of the library in the Load event of the app form, but the app totally died then without even giving me any info. I moved it into the code for a button press. So when you run the app the form appears and it is only when you hit the button and try to create one of the assembly classes that the badimage exception is thrown.
Exception.gif
davidc4887Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
feenixConnect With a Mentor Commented:
You haven't set your VB application to be compiled as 32bit, it seems. Take properties of the VB application TestApp, Compile, Advanced Compile Options and there you still have AnyCPU. Change that to x86 and it'll work.

(I only have Visual Studio 2010 installed, so the settings could be a bit different on VS 2008)
0
All Courses

From novice to tech pro — start learning today.