views:

209

answers:

2

I have a lot of sharepoint web parts etc all of which are compiled for any cpu, they run fine on 32bit sharepoint but moving to server 2008 in 64bit causes the following error:

An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

From my reading they should all work fine?

A: 

You can't mix 32bit and 64bit assemblies. Your only option is to rebuild your binaries to x64.

You can run 32bit binaries/libraries on 64bit OS, but again you cannot mix them together.

Ravenheart
+2  A: 
  1. 64-bit processes cannot load 32-bit DLLs and vice versa.
  2. IIS is a 64-bit process on 64-bit hardware. It's possible to configure individual application pools to run 32-bit, but ...
  3. Sharepoint is most likely to be running 64-bit.

Therefore, your assemblies and all of their dependent assemblies and DLLs will have to run 64-bit.

Note that .NET assemblies that are marked as "Any CPU" will run as 64-bit on 64-bit hardware. Any native DLLs, however, will need to be compiled natively as 64-bit.

Paul Lalonde
ok thanks, i will have to explore the code some more and find out if we are using any other DLLs anwhere which may be causing the problem, i thought that the only dependancies were for microsoft.sharepoint dll, and with 64bit sharepoint installed that shouldn't be a problem.
Nathan
@Nathan, do you depend on any in-process COM objects? Those need to be 64-bit (point #1 above).
Paul Lalonde
Nope no COM stuff, and no 64bit dlls except what we have made and they are all compiled for anyCPU and so should work too, most parts work fine but just a few web parts have this error, and if you debug into them they just loop over the render function.
Nathan