Visual studio 2005 C# projects default to building for the "Any CPU" target. If you're trying to P/Invoke a method defined in a 32-bit DLL while running on 64-bit windows then this will cause a "BadImageFormatException". I believe this is because the "run" VS2005 functionality defaults to executing the 64-bit CLR which probably can't read 32-bit DLLs.
The solution is to change the target to x86. Or to build the 32-bit DLL as a 64-bit DLL but I haven't gotten that far yet!