The latest one is trying to develop using C# Express 2008 on Windows XP 64 Bit Edition and then using interoperability with a 32 Bit DLL - OpenAl. For some reason the compiler doesn't realise that the 32 Bit DLL is just that, 32 Bits. By default any .Net application developed will target the platform called "Any CPU" as opposed to a specific architecture. This is cool if your not using native DLL's but is a bit of a pain when you do. You will know that you are getting this problem when you start seeing System.BadImageFormatException popping up. It means that your application is trying to cross the Bit boundary - apparently our gracious OS is a separatist?
Any way there seems to be a saving grace, you can do development on a 64 Bit OS and set C# Express to specifically target your application to x86, it's just not obvious. Targeting x86 will mean that your application will still run on a 64 Bit OS but will use WoW (Windows on Windows, which is a compatibility layer to backwards support 32 Bit applications) so you won't get the native use of those 64 Bit Int's but you will be able to use your 32 Bit DLL's.
To setup your application to do this you need to
- G in to the menu option Tools>Options and the in the dialog box tick the box in the bottom right corner to "Show all settings"
- Once the settings expand go to "Projects and Settings" expand it and click on "General"
- Check the option which is called "Show advanced build configurations", then close the dialog box
- Now if you right click on the solution explorer, chose properties
- Goto "Configuration Properties", now you should be able to see the platform drop down. This will probably have only "Any CPU" selected; if so click on "Configuration Manager"
- Chose the option "New" under the "Active Solution Platform" drop down box
- Chose the new platform of x86 and copy your settings from "Any CPU"
- Then just make sure that your projects in your solution refer to x86 as the platform rather that "Any CPU"
9 comments:
Thanks a lot, solved the problem
Now Direct3D works fine in VB.NET thanks!
I wasn't able to get Direct3D to render properly on my main form until I followed the instructions here and now it's working.
Many many thanks for your post. I couldn't find any clear instructions on how to fix it anywhere. Now I can continue with my C# assignments.
You are the best person in the world!
Great!
Thanks a bunch! This fixes an issue we had with the JET database driver.
Thanks!
Thanks. This was a big help
Thanks. This helped a lot
Post a Comment