microsoft / Chakra-Samples

Repository for Chakra JavaScript engine related samples.
MIT License
216 stars 84 forks source link

Bad Image Format HRESULT: 0x8007000B with C# and how to mitigate it #22

Closed brakmic closed 8 years ago

brakmic commented 8 years ago

Hi,

I encountered a strange BadImageFormat Exception when trying to build the HelloWorld Demo. My setup is VS2015 Debug x64, and before setting up this demo project I compiled the ChakraCore.dll by following the Wiki-tutorial.

This happened when I tried to run the console app:

exception

This was very unusual because my Debug-Build is also x64 just like the ChakraCore.dll from the C++ project.

After some experimenting I changed the Platform Target from Any CPU to x64 in Project's Build-Properties:

target

Now everything worked as expected. :smile:

ok

Maybe someone could put this info on the WIki? Don't want to unilaterally change it. Thanks!

Regards, Harris

liminzhu commented 8 years ago

Thanks for reporting this to us @brakmic ! Yes, the platform target of your app and the DLL platform need to match for this to work lol. I'll add a note on wiki.

liminzhu commented 8 years ago

Added a note on wiki: Make sure the build targets the same platform as the ChakraCore.dll you built earlier.