.net Framework Error (HRESULT 0x8007000B)
Project Properties -> Build -> Platform target -> x86 may solve this problem.
While your main app might be built for AnyCPU are you sure all the assemblies are AnyCPU? Do you have any native assemblies or assemblies that contain native code? Are they built against x86?
file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll
This tells me that the app is running as an x64 process but it would appear that there is some assembly that isn't AnyCPU or x64 which is likely the cause of the BadImageFormatException.
One thing you can try is to run the application from a 32-bit command prompt (c:\windows\SysWow64\cmd.exe) to force it to be a 32-bit process and see if that works. If that works then there is definitely some assembly that is not AnyCPU.
One of the most common mistake is we forgot to change the test program and wrapper program to the correct platform. See the below image
(in the top bar it is showing the platform is x64 but you need to make sure if it is really exists in the 2nd image ...)
Make sure you have right configuration on the Configuration Manager...if your config do not match with the actual config of your c++ dll it will give BadImageFormatException.
I learned from the mistake after searching a lot ... and finally got this
In my case I had the 0x8007000B error because the app was running in 32 bit, on my 64 windows 7. I solved it by going in windows/syswov64 folder changing the MSVCR110.dll version 64 bit with the MSVCR110.dll version 32 bit.
(Just don't forget to put back the 64 dll after. Each time you need to run your 32 bit app, just move the dll 32 on it).
You could find the dll versions here (Unzip it before pasting into the syswov64 folder).