We’ve had a 32 bit terminal services computer running some Windows services we constructed using .NET. Recently we moved everything to a 64 bit machine. Most things work. However, we are getting grief from a dll for apachefop.net.
In particular we get the following error
Error: Plugin Transcript Service
Execution Failed: Could not load file
or assembly ‘apachefop.net,
Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null’ or one of its
dependencies. An attempt was made to
load a program with an incorrect
format.
I’m guessing that this is because it isn’t meant to work on a 64 bit machine. Any suggestions about how to rectify this type of situation?
The problems seems to be caused by the fact that your assembly has been compiled with the anycpu setting. In this mode, when run on a 64 bits machine, your process automatically becomes a 64 bits process while your native references don’t… And as it is not possible to load 32bits libraries from a 64 bits process you’re running into troubles.
To quickly diagnose if it is the case you can use the corflags.exe which is part of the .net framework :
corflags.exe pathtoyourdotnetprogram /32bit+
Then run your program. If your soft is running well, then you should change the anycpu settings in your project to force the compiler to compile to a 32bits assembly.